Skip to content

Instantly share code, notes, and snippets.

@kyleroberthammond
Created April 4, 2016 21:24
Show Gist options
  • Save kyleroberthammond/9e2927fad388de22e57dee4ed8e42938 to your computer and use it in GitHub Desktop.
Save kyleroberthammond/9e2927fad388de22e57dee4ed8e42938 to your computer and use it in GitHub Desktop.
To only run the next two migrations:
rake db:migrate STEP=2
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.
Growing Rails Applications in Practice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment