I have the migration file db\migrate\20100905201547_create_blocks.rb.
How can I specifically rollback that migration file?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Is a way to do this, if the migration you want to rollback is the last one applied. You can substitute 1 for however many migrations you want to go back.
For example:
Will also rollback all the migration that happened later (4, 3, 2 and also 1).
To roll back all migrations back to (and including) a target migration, use: (This corrected command was added after all the comments pointing out the error in the original post)
In order to rollback only one specific migration (out of order) use:
Note that this will NOT rollback any interceding migrations — only the one listed. If that is not what you intended, you can safely run
rake db:migrateand it will re-run only that one, skipping any others that were not previously rolled back.And if you ever want to migrate a single migration out of order, there is also its inverse
db:migrate:up: