<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -45,7 +45,7 @@ namespace :db do
       when 'postgresql'
         @encoding = config[:encoding] || ENV['CHARSET'] || 'utf8'
         begin
-          ActiveRecord::Base.establish_connection(config.merge('database' =&gt; nil))
+          ActiveRecord::Base.establish_connection(config.merge('database' =&gt; 'template1'))
           ActiveRecord::Base.connection.create_database(config['database'], :encoding =&gt; @encoding)
           ActiveRecord::Base.establish_connection(config)
         rescue
@@ -373,7 +373,7 @@ def drop_database(config)
   when /^sqlite/
     FileUtils.rm(File.join(RAILS_ROOT, config['database']))
   when 'postgresql'
-    ActiveRecord::Base.establish_connection(config.merge('database' =&gt; nil))
+    ActiveRecord::Base.establish_connection(config.merge('database' =&gt; 'template1'))
     ActiveRecord::Base.connection.drop_database config['database']
   end
 end</diff>
      <filename>railties/lib/tasks/databases.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>96980bd561d79824b6cb6efbcbecdcbf8785d452</id>
    </parent>
  </parents>
  <author>
    <name>Pete Deffendol</name>
    <email>pete@mdsc.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/205750c8dead2449a23173fab0720b7701231d2a</url>
  <id>205750c8dead2449a23173fab0720b7701231d2a</id>
  <committed-date>2008-05-03T17:20:14-07:00</committed-date>
  <authored-date>2008-04-22T13:23:17-07:00</authored-date>
  <message>PostgreSQL: Connect to template1 database when creating or dropping db

 * The template1 database is always available on a PostgreSQL install
 * The previous behavior expected a database with the same name as the
   connecting user, which may not be available

Signed-off-by: Michael Koziarski &lt;michael@koziarski.com&gt;

[#38 state:resolved]</message>
  <tree>10e133ee8db1c2e99b304ae6b0e88b178a54f7ea</tree>
  <committer>
    <name>Michael Koziarski</name>
    <email>michael@koziarski.com</email>
  </committer>
</commit>
