Created
February 9, 2010 15:57
-
-
Save nmerouze/299339 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 "Migrate the database through scripts in db/migrate and update db/schema.rb by invoking db:schema:dump. Target specific version with VERSION=x. Turn off output with VERBOSE=false." | |
task :migrate => :environment do | |
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true | |
ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil) | |
Rails.application.railties.engines.each do |engine| | |
ActiveRecord::Migrator.migrate(engine.root + "db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil) | |
end | |
Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment