Reputation: 944
The last migration that I ran was not completed because of errors. It can't be reverted with rails db:rollback
(nor with rake db:migrate:down VERSION=xxx
) because this commands tries to drop databases that were not created (or that I destroyed to try to solve the issue).
Is there a way to switch to down
the status of the last migration, and that it doesn't try to affect the database?
The following worked: editing the migration file, renaming the change
method to up
, adding an empty down
method, and running the rails db:rollback
again. Nonetheless, I was wondering if there was a better solution.
(Note that this question is not about cleaning up the failures but just about switching the last migration status to down
.)
Upvotes: 0
Views: 242
Reputation: 19879
You should have a schema_migrations
table in your database with a single version
column which will have the numerical portion of your migration. Simply delete that row.
Upvotes: 3