We create the database manually and it comes with the defaults of the system. Currently Debian's Mariadb default charset is utf8mb4, the full utf8 supporting emojis etc. The bigger charset can cause hitting limits on indexes:
Mysql2::Error: Specified key was too long; max key length is 767 bytes: CREATE UNIQUE INDEX `index_user_flags_on_user_id_and_name` ON `user_flags` (`user_id`, `name`)
Enabling a higher index length limit needs a few changes to the database configuration and each table. Defining the charset for each table would be a bit hacky with Rails. So until we completely migrate to utf8mb4, we need to create the database with utf8 as default or new tables introduced by migrations will have the wrong charset. This is the same behaviour as rake db:create which seems to set utf8 as default charset for the database.
We create the database manually and it comes with the defaults of the system. Currently Debian's Mariadb default charset is
utf8mb4
, the full utf8 supporting emojis etc. The bigger charset can cause hitting limits on indexes:Enabling a higher index length limit needs a few changes to the database configuration and each table. Defining the charset for each table would be a bit hacky with Rails. So until we completely migrate to
utf8mb4
, we need to create the database withutf8
as default or new tables introduced by migrations will have the wrong charset. This is the same behaviour asrake db:create
which seems to set utf8 as default charset for the database.