What can cause db:rollback to fail?
I'm trying to rollback my rails3 database (postgresql) a few steps to make some changes.
I added a migration file today. rake db:rollback successfully rolled back.
I'm now trying to go back further, but rake db:rollback doesn't appear to be working.
running db:rollback开发者_JS百科 with a trace, I get
(in /rails/app/path/railsapp)
** Invoke db:rollback (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:rollback
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
but no indication that a creation has reverted or a table has been dropped.
I can't seem to find much info on this, so I'm wondering - what can cause a db:rollback to fail?
Has anyone else encountered this?
I'll answer my own question here, and blame my failure to see the obvious on working too late at night!
Somehow I had deleted a migration file I wasn't supposed to. Obviously Rails couldn't find the migration it expected, and so the rollback failed.
Solution?
Thankfully the migration in question was still in the trash. Restore. Rollback. Done!
精彩评论