Created
January 22, 2009 15:34
-
-
Save alkema/50575 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'rubygems' | |
require 'active_record' | |
desc 'migrate legacy table to add column' | |
namespace :document_manager do | |
namespace :db do | |
task :migrate do | |
ActiveRecord::Base.clear_active_connections! | |
configs = open('config/database.yml') { |f| YAML.load(f) } | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Base.configurations = configs | |
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['document_manager'][ENV['RAILS_ENV'] ]) | |
ActiveRecord::Base.connection.initialize_schema_migrations_table | |
ActiveRecord::Migration.verbose = true | |
ActiveRecord::Migrator.migrate("db/document_manager_migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil) | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment