I've deleted a table in the database, call it X. db:migrate no longer works. I have a migration file called CreateX. Is there a way to run just that specific migration?
1
-
2The question is a duplicate. The answer here is better.– ConnorWGarveyDec 1, 2015 at 21:03
Add a comment
|
1 Answer
rake db:migrate:redo VERSION=my_version
Or you can go up or down from a specific version:
db:migrate:up VERSION=my_version
db:migrate:down VERSION=my_version
-
1rake db:migrate:redo seems to work for me (db:specific:redo just gives an error, I'm imagining a version issue)– DanielAug 22, 2009 at 20:01
-
Oops yah, you were right, that was my custom rake task mixed in, but I fixed it those should work well now. Aug 22, 2009 at 20:03
-
38N.B. If the table has been dropped from the database,
rake db:migrate:up VERSION=my_version
may do nothing, because the schema_migrations table still says it is done. In the same situationrake db:migrate:redo VERSION=my_version
may fail because it cannot drop the table. In this case, comment out thedown
method in the migration temporarily and re-runrake db:migrate:redo...
– LeoSep 8, 2012 at 11:54