diff options
-rw-r--r-- | railties/lib/tasks/databases.rake | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake index e39f9ca197..20fdcce205 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' => nil)) + ActiveRecord::Base.establish_connection(config.merge('database' => 'template1')) ActiveRecord::Base.connection.create_database(config['database'], :encoding => @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' => nil)) + ActiveRecord::Base.establish_connection(config.merge('database' => 'template1')) ActiveRecord::Base.connection.drop_database config['database'] end end |