diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-30 05:39:49 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-30 05:39:49 +0000 |
commit | a1c88273f4321e203ccf389ccff8a8e043c4f8f9 (patch) | |
tree | c2c104cf4d8444bef1e767298455ac62b7403bf3 /railties/lib | |
parent | 186ac4cdaa911a9af659a29f2179a19b99dea13b (diff) | |
download | rails-a1c88273f4321e203ccf389ccff8a8e043c4f8f9.tar.gz rails-a1c88273f4321e203ccf389ccff8a8e043c4f8f9.tar.bz2 rails-a1c88273f4321e203ccf389ccff8a8e043c4f8f9.zip |
Skip databases that couldn't be created.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6900 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/tasks/databases.rake | 10 |
1 files changed, 7 insertions, 3 deletions
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' |