Skip to content

Instantly share code, notes, and snippets.

@mikebaldry
Created October 18, 2012 07:34
Show Gist options
  • Save mikebaldry/3910301 to your computer and use it in GitHub Desktop.
Save mikebaldry/3910301 to your computer and use it in GitHub Desktop.
namespace :db do
desc "Rolls the schema back to the previous version. Specify the number of steps with STEP=n"
task :rollback => :environment do
step = ENV['STEP'] ? ENV['STEP'].to_i : 1
version = ActiveRecord::Migrator.current_version - step
ActiveRecord::Migrator.migrate('db/migrate/', version)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment