Rails: Running specific migrations

When running migrations with rake db:migrate, there's the STEP and VERSION parameters that you can pass to nearly all commands.

# Migrate
rake db:migrate
rake db:migrate STEP=2
rake db:migrate VERSION=20080906120000

# Redo
rake db:migrate:redo
rake db:migrate:redo STEP=2
rake db:migrate:redo VERSION=20080906120000

# Rollback (starting from latest migration)
rake db:rollback
rake db:rollback STEP=2

# Run the `down` migration path of a certain migration file
rake db:migrate:down VERSION=20080906120000
Thomas Klemm About 9 years ago