public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
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.
Tarmo Tänav (author)
Tue May 13 07:26:05 -0700 2008
lifo (committer)
Tue May 13 09:34:47 -0700 2008
commit  4dedc7ddcaffa8c606af11ae2d32707131b99a2e
tree    9716be68b8e2695153f54e2654cc9cc3c0f80be1
parent  9fb01ce4b194567e84fa2f8582410fc76720a31f
...
45
46
47
48
 
49
50
51
...
368
369
370
371
 
372
373
374
...
45
46
47
 
48
49
50
51
...
368
369
370
 
371
372
373
374
0
@@ -45,7 +45,7 @@ namespace :db do
0
       when 'postgresql'
0
         @encoding = config[:encoding] || ENV['CHARSET'] || 'utf8'
0
         begin
0
-          ActiveRecord::Base.establish_connection(config.merge('database' => 'template1'))
0
+          ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres'))
0
           ActiveRecord::Base.connection.create_database(config['database'], config.merge('encoding' => @encoding))
0
           ActiveRecord::Base.establish_connection(config)
0
         rescue
0
@@ -368,7 +368,7 @@ def drop_database(config)
0
   when /^sqlite/
0
     FileUtils.rm(File.join(RAILS_ROOT, config['database']))
0
   when 'postgresql'
0
-    ActiveRecord::Base.establish_connection(config.merge('database' => 'template1'))
0
+    ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres'))
0
     ActiveRecord::Base.connection.drop_database config['database']
0
   end
0
 end

Comments