Created
March 3, 2009 23:19
-
-
Save lancecarlson/73609 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
namespace :db do | |
desc "Perform automigration" | |
task :automigrate => :environment do | |
::DataMapper::AutoMigrator.auto_migrate | |
end | |
desc "Perform non destructive automigration" | |
task :autoupgrade => :environment do | |
::DataMapper::AutoMigrator.auto_upgrade | |
end | |
namespace :migrate do | |
task :load => :environment do | |
gem 'dm-migrations' | |
FileList["db/migrations/*.rb"].each do |migration| | |
load migration | |
end | |
end | |
desc "Migrate up using migrations" | |
task :up, :version, :needs => :load do |t, args| | |
version = args[:version] | |
migrate_up!(version) | |
end | |
desc "Migrate down using migrations" | |
task :down, :version, :needs => :load do |t, args| | |
version = args[:version] | |
migrate_down!(version) | |
end | |
end | |
desc "Migrate the database to the latest version" | |
task :migrate => 'db:migrate:up' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment