mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-15 19:31:26 +00:00
Create database in utf8
even if DATABASE_ENCODING is utf8mb4
.
This is because we specify the `utf8mb4` charset in some of the columns and expect others to be defaulted to `utf8`. I'd like to make this a feature of `ar_mysql_column_charset`. If you want to set a table charset, you can always pass a keyword option `options: "default charset=utf8mb4"` to `create_table`. Complements #414.
This commit is contained in:
parent
7fc9fbb2d6
commit
41eb277475
1 changed files with 9 additions and 0 deletions
|
@ -63,6 +63,15 @@ module ActiveRecord::ConnectionAdapters
|
|||
end
|
||||
}
|
||||
end
|
||||
|
||||
def create_database(name, options = {})
|
||||
# utf8mb4 is used in column definitions; use utf8 for
|
||||
# databases.
|
||||
if options[:charset] == 'utf8mb4'
|
||||
options = options.merge(charset: 'utf8')
|
||||
end
|
||||
super(name, options)
|
||||
end
|
||||
end
|
||||
|
||||
prepend CharsetSupport
|
||||
|
|
Loading…
Add table
Reference in a new issue