0

I couldn't find the answer to similar questions regarding rake db:migrate failing without error messages. I tried raking a particular version and that didn't work either. I get the following:

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke environment 
** Invoke db:load_config 
** Execute db:schema:dump

I ran rake db:migrate:status and it told me that several migration files were missing but I have no idea what they were. Just the missing files.

up     20140506035953  ********** NO FILE **********
up     20140506035954  ********** NO FILE **********
up     20140506035955  ********** NO FILE **********

I thought that deleting the entries from the schema_migrations table would resolve the problem but it didn't.

I believe the problem started after running bundle update. I'm running rails 4.1.4, ruby 2.1.3p242 using RVM on a Mac with 10.9.5. Running "rake about" gives the following:

About your application's environment
Ruby version              2.1.3-p242 (x86_64-darwin14.0)
RubyGems version          2.2.2
Rack version              1.5
Rails version             4.1.4
JavaScript Runtime        Node.js (V8)
Active Record version     4.1.4
Action Pack version       4.1.4
Action View version       4.1.4
Action Mailer version     4.1.4
Active Support version    4.1.4
Middleware                Rack::Sendfile, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007fadd50e54e0>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, Rack::Head, Rack::ConditionalGet, Rack::ETag
Environment               development
Database adapter          postgresql
Database schema version   20141117165919

Additional information:

This is being dumped to my log file.

[1m[36mActiveRecord::SchemaMigration Load (0.9ms)[0m  [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
[1m[35mActiveRecord::SchemaMigration Load (0.4ms)[0m  SELECT "schema_migrations".* FROM "schema_migrations"

Any suggestions appreciated.

rustyHack
  • 63
  • 8
  • The missing migrations files didn't cause the problem. I removed references to them in schema_migration table and still have the same issue. I was hoping someone had suggestions on debugging the problem. At this time point, it appears I'll have to go old school with SQL to create and manage tables. – rustyHack Nov 19 '14 at 02:41

2 Answers2

0

I need to respond to this as an answer as I can't comment yet without enough rep (seems silly as a comment might be better at this point).

However the files missing are likely old migration files that would start with the timestamp filename followed by the method. eg.

20140506035953_create_table.rb

At some point you must have deleted migration files because you no longer wanted or needed them.

If the migration results in a functioning database than I wouldn't worry about it.

Shazam
  • 301
  • 1
  • 2
  • 16
  • The missing migrations files didn't cause the problem. I removed references to them in schema_migration table and still have the same issue. I was hoping someone had suggestions on debugging the problem. At this time point, it appears I'll have to go old school with SQL to create and manage tables. – rustyHack Nov 19 '14 at 03:10
0

I found the answer at Rails rake db:migrate has no effect . I tried running the VERSION option before without success. Adding "redo" with a specific version number worked. The following fixed the problem.

rake db:migrate:redo VERSION=20141117165919 --trace
Community
  • 1
  • 1
rustyHack
  • 63
  • 8