Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nmerouze
Created February 9, 2010 15:57
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 nmerouze/299339 to your computer and use it in GitHub Desktop.
Save nmerouze/299339 to your computer and use it in GitHub Desktop.
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