Rake just one migration Rake just one migration ruby-on-rails ruby-on-rails

Rake just one migration


rake db:migrate:redo VERSION=xxxxxxx, but that will run the down and then the up step. You could do this in conjunction with commenting out the down step temporarily.


rake db:migrate:up VERSION=1234567890

similarly rake db:migrate:down to take a specific migration down. You can get a list of available rake tasks with rake -T.


I've had to run a single migration that changed and needed to be re-run independently of all other migrations. Fire up the console and do this:

>> require 'db/migrate/your_migrations.rb'=> ["YourMigrations"]>> YourMigrations.up=> etc... as the migration runs>> YourMigration.down

More usefully this could be put into a rake task etc.