Created
July 7, 2010 12:52
-
-
Save MirkoCindric/466646 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Simple task that updates development and test db all at once. | |
namespace :db do | |
namespace :migrate do | |
desc "Migrates development and test databases" | |
task :all do | |
puts "Migrating development database" | |
Rake::Task["db:migrate"].invoke | |
puts "Migrating test database" | |
Rake::Task["db:test:clone"].invoke | |
end | |
desc "Rollback the database schema to the previous version" | |
task :rollback => :environment do | |
previous_version = ActiveRecord::Migrator.current_version.to_i - 1 | |
ActiveRecord::Migrator.migrate("db/migrate/", previous_version) | |
puts "Schema rolled back to previous verison (#{previous_version})." | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment