diff options
Diffstat (limited to 'activerecord/lib/active_record/railties/databases.rake')
-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 |