diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2012-09-21 11:37:25 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2012-09-21 11:37:49 -0700 |
commit | 57bdafb932e891e3a732ad3ea31349f61833b126 (patch) | |
tree | f5b6853ecd9038eb6fd8c0839e05b483ee46ba84 | |
parent | 96ded2efb7fc8ad5415c25e05fe1b7b4cd3b0fb4 (diff) | |
download | rails-57bdafb932e891e3a732ad3ea31349f61833b126.tar.gz rails-57bdafb932e891e3a732ad3ea31349f61833b126.tar.bz2 rails-57bdafb932e891e3a732ad3ea31349f61833b126.zip |
Use default charset/collation only if *neither* is specified. Otherwise we set utf8_unicode_ci collation on latin1 table.
-rw-r--r-- | activerecord/lib/active_record/tasks/mysql_database_tasks.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb index 2340f949b7..7abbf08571 100644 --- a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb @@ -73,11 +73,14 @@ module ActiveRecord configuration.merge('database' => nil) end + # If neither encoding nor collation is specified, use the utf-8 defaults. def creation_options - { - charset: (configuration['encoding'] || DEFAULT_CHARSET), - collation: (configuration['collation'] || DEFAULT_COLLATION) - } + options = configuration.slice('encoding', 'collation').symbolize_keys + if options.empty? + { charset: DEFAULT_CHARSET, collation: DEFAULT_COLLATION } + else + options + end end def error_class |