Skip to content

Instantly share code, notes, and snippets.

@armstrongnate
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save armstrongnate/a592b06e49f03dd0c468 to your computer and use it in GitHub Desktop.
Save armstrongnate/a592b06e49f03dd0c468 to your computer and use it in GitHub Desktop.
Cherry pick a migration
## One way to do it is from the rails console:
require 'db/migrate/MIGRATION_FILE_NAME.rb'
# if using def change
MigrationClass.new.migrate(:down)
# if using up or down
MigrationClass.up
## Another way is using a rake task
rake db:migrate:up VERSION=20090408054532
# The second option is probably preferred because it updates the schema, however,
# it won't work if it has already behind or something.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment