From a1c88273f4321e203ccf389ccff8a8e043c4f8f9 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 30 May 2007 05:39:49 +0000 Subject: Skip databases that couldn't be created. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6900 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/lib/tasks/databases.rake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake index f382d97174..cad6d35077 100644 --- a/railties/lib/tasks/databases.rake +++ b/railties/lib/tasks/databases.rake @@ -12,9 +12,13 @@ namespace :db do @charset = ENV['CHARSET'] || 'utf8' @collation = ENV['COLLATION'] || 'utf8_general_ci' - ActiveRecord::Base.establish_connection(config.merge({'database' => nil})) - ActiveRecord::Base.connection.create_database(config['database'], {:charset => @charset, :collation => @collation}) - ActiveRecord::Base.establish_connection(config) + begin + ActiveRecord::Base.establish_connection(config.merge({'database' => nil})) + ActiveRecord::Base.connection.create_database(config['database'], {:charset => @charset, :collation => @collation}) + ActiveRecord::Base.establish_connection(config) + rescue + $stderr.puts "Couldn't create database for #{config.inspect}" + end when 'postgresql' `createdb "#{config['database']}" -E utf8` when 'sqlite' -- cgit v1.2.3