How do I run a migration again, without deleting all the newer migrations?
rake db:migrate:up VERSION=20090408054532
this will migrate all file upto VERSION=20090408054532
checkout Run a single migration file
Thanks for the help everyone. This is what worked for me:
WARNING: these commands will delete all data in your database!
rake db:drop
rake db:create
rake db:migrate
If you are developing locally and it wouldn't hurt to remove all data from your models you could simply drop
your db and then create
& migrate
from scratch:
Purge or recreate a Ruby on Rails database
It will run the down and then the up step (This command can drop your table!):
rake db:migrate:redo VERSION=xxxxxxx
To prevent your table from being deleted you could do this in conjunction with commenting out the down
step temporarily.