diff options
author | Arun Agrawal <arun@fromjaipur.com> | 2011-04-27 00:57:50 +0530 |
---|---|---|
committer | Arun Agrawal <arun@fromjaipur.com> | 2011-04-27 00:57:50 +0530 |
commit | c8102817ca0d355ece8b60007d230ab9292e7031 (patch) | |
tree | e2b8da3863c994fb62a6bc50a6ce60980ba6731c /activerecord | |
parent | 4ce14fb0809ea8d636be0a1790fa38eafe64a46f (diff) | |
download | rails-c8102817ca0d355ece8b60007d230ab9292e7031.tar.gz rails-c8102817ca0d355ece8b60007d230ab9292e7031.tar.bz2 rails-c8102817ca0d355ece8b60007d230ab9292e7031.zip |
Re-factored database.rake to allow Jdbcpostgresql. #jruby
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/railties/databases.rake | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 7d76d7a19f..1fc69130c7 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -244,7 +244,7 @@ db_namespace = namespace :db do when /mysql/ ActiveRecord::Base.establish_connection(config) puts ActiveRecord::Base.connection.charset - when 'postgresql' + when /postgresql/ ActiveRecord::Base.establish_connection(config) puts ActiveRecord::Base.connection.encoding when 'sqlite3' @@ -362,7 +362,7 @@ db_namespace = namespace :db do when /mysql/, "oci", "oracle" ActiveRecord::Base.establish_connection(abcs[Rails.env]) File.open("#{Rails.root}/db/#{Rails.env}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump } - when "postgresql" + when /postgresql/ ENV['PGHOST'] = abcs[Rails.env]["host"] if abcs[Rails.env]["host"] ENV['PGPORT'] = abcs[Rails.env]["port"].to_s if abcs[Rails.env]["port"] ENV['PGPASSWORD'] = abcs[Rails.env]["password"].to_s if abcs[Rails.env]["password"] @@ -413,7 +413,7 @@ db_namespace = namespace :db do IO.readlines("#{Rails.root}/db/#{Rails.env}_structure.sql").join.split("\n\n").each do |table| ActiveRecord::Base.connection.execute(table) end - when "postgresql" + when /postgresql/ ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"] ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"] ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"] @@ -444,7 +444,7 @@ db_namespace = namespace :db do when /mysql/ ActiveRecord::Base.establish_connection(:test) ActiveRecord::Base.connection.recreate_database(abcs["test"]["database"], abcs["test"]) - when "postgresql" + when /postgresql/ ActiveRecord::Base.clear_active_connections! drop_database(abcs['test']) create_database(abcs['test']) @@ -534,7 +534,7 @@ def drop_database(config) file = path.absolute? ? path.to_s : File.join(Rails.root, path) FileUtils.rm(file) - when 'postgresql' + when /postgresql/ ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public')) ActiveRecord::Base.connection.drop_database config['database'] end |