Created
November 2, 2010 20:13
-
-
Save mistersourcerer/660207 to your computer and use it in GitHub Desktop.
Migrate all environments
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 all enviroments" | |
namespace :migrate do | |
task :all do | |
#current_rails_env = Rails.env | |
db_config = YAML::load(File.read(File.join(Rails.root, "/config/database.yml"))) | |
db_config.keys.each do |e| | |
#Rails.env = e | |
#Rake::Task['db:migrate'].invoke | |
puts "migrating: #{e}" | |
system("rake db:migrate RAILS_ENV=#{e}") | |
puts "-------------" | |
end | |
#Rails.env = current_rails_env | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment