Read more

Migrate or revert only some migrations

Henning Koch
November 11, 2010Software engineer at makandra GmbH

To only run the next two migrations:

rake db:migrate STEP=2
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

To revert the previous two migrations:

rake db:rollback STEP=2

To revert the last two migrations and then migrate to the most current version:

rake db:migrate:redo STEP=2

To migrate to a given migration number, regardless of whether that means migrating up or down:

rake db:migrate VERSION=20100627185630

To migrate exactly one individual migration out of the sequence* (careful):

rake db:migrate:up VERSION=20100627185630

To revert exactly one individual migration out of the sequence* (careful):

rake db:migrate:down VERSION=20100627185630

*) These migrations must (not) have been processed before (contained/not contained in the schema_migrations table) or nothing will happen.

Posted by Henning Koch to makandra dev (2010-11-11 12:34)