0

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.)

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

That's definitely a better solution. I guess that there is no direct command to do it then.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.