aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/tasks
diff options
context:
space:
mode:
authorTarmo Tänav <tarmo@itech.ee>2008-05-13 17:26:05 +0300
committerPratik Naik <pratiknaik@gmail.com>2008-05-13 17:34:47 +0100
commit4dedc7ddcaffa8c606af11ae2d32707131b99a2e (patch)
tree9716be68b8e2695153f54e2654cc9cc3c0f80be1 /railties/lib/tasks
parent9fb01ce4b194567e84fa2f8582410fc76720a31f (diff)
downloadrails-4dedc7ddcaffa8c606af11ae2d32707131b99a2e.tar.gz
rails-4dedc7ddcaffa8c606af11ae2d32707131b99a2e.tar.bz2
rails-4dedc7ddcaffa8c606af11ae2d32707131b99a2e.zip
Use 'postgres' database instead of 'template1'
The 'postgres' database is meant for use by utilities and third party applications. CONNECT permission to the 'template1' database is usually only available to superusers which is why 'postgres' should be preferred as users whith "CREATE DATABASE" permissions are not neccessarily superusers.
Diffstat (limited to 'railties/lib/tasks')
-rw-r--r--railties/lib/tasks/databases.rake4
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake
index 63f71448f8..fe099e30b9 100644
--- a/railties/lib/tasks/databases.rake
+++ b/railties/lib/tasks/databases.rake
@@ -45,7 +45,7 @@ namespace :db do
when 'postgresql'
@encoding = config[:encoding] || ENV['CHARSET'] || 'utf8'
begin
- ActiveRecord::Base.establish_connection(config.merge('database' => 'template1'))
+ ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres'))
ActiveRecord::Base.connection.create_database(config['database'], config.merge('encoding' => @encoding))
ActiveRecord::Base.establish_connection(config)
rescue
@@ -368,7 +368,7 @@ def drop_database(config)
when /^sqlite/
FileUtils.rm(File.join(RAILS_ROOT, config['database']))
when 'postgresql'
- ActiveRecord::Base.establish_connection(config.merge('database' => 'template1'))
+ ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres'))
ActiveRecord::Base.connection.drop_database config['database']
end
end