Posted almost 7 years ago. Visible to the public.

Migrate or revert only some migrations

To only run the next two migrations:

Copy
rake db:migrate STEP=2

To revert the previous two migrations:

Copy
rake db:rollback STEP=2

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

Copy
rake db:migrate:redo STEP=2

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

Copy
rake db:migrate VERSION=20100627185630

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

Copy
rake db:migrate:up VERSION=20100627185630

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

Copy
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.

Once an application no longer requires constant development, it needs periodic maintenance for stable and secure operation. makandra offers monthly maintenance contracts that let you focus on your business while we make sure the lights stay on.

Author of this card:

Avatar
Henning Koch
Keywords:
database, table, column, up, down, single
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Henning Koch to makandropedia