mirror of
https://github.com/github/rails.git
synced 2026-02-01 17:54:59 -05:00
Fixed charset/collation for rake db:create (closes #11331) [matt]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9170 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -37,10 +37,10 @@ namespace :db do
|
||||
@collation = ENV['COLLATION'] || 'utf8_general_ci'
|
||||
begin
|
||||
ActiveRecord::Base.establish_connection(config.merge({'database' => nil}))
|
||||
ActiveRecord::Base.connection.create_database(config['database'], {:charset => (config['database']['charset'] || @charset), :collation => (config['database']['charset'] || @collation)})
|
||||
ActiveRecord::Base.connection.create_database(config['database'], {:charset => (config['charset'] || @charset), :collation => (config['collation'] || @collation)})
|
||||
ActiveRecord::Base.establish_connection(config)
|
||||
rescue
|
||||
$stderr.puts "Couldn't create database for #{config.inspect}, charset: #{@charset}, collation: #{@collation} (if you set the charset manually, make sure you have a matching collation)"
|
||||
$stderr.puts "Couldn't create database for #{config.inspect}, charset: #{config['charset'] || @charset}, collation: #{config['collation'] || @collation} (if you set the charset manually, make sure you have a matching collation)"
|
||||
end
|
||||
when 'postgresql'
|
||||
`createdb "#{config['database']}" -E utf8`
|
||||
|
||||
Reference in New Issue
Block a user