Open cdauth opened 3 years ago
Feel free to suggest a PR on this files : https://github.com/YunoHost/yunohost/blob/dev/data/helpers.d/mysql#L92 And create a migration: https://github.com/YunoHost/yunohost/tree/dev/src/yunohost/data_migrations
I think difficulties are to manage migration of old database and restore operation from database version in latin1...
I've done something like that here: https://github.com/YunoHost-Apps/nextcloud_ynh/pull/384/files
I'm installing an app whose installation script sets up a MySQL database using
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
. The problem is that the database is created with alatin1_swedish_ci
collation, which causes problems in the app when users try to save characters that are not contained in the Latin-1 charset.It seems to me that it would be better if databases were initialized with the
utf8mb4_general_ci
collation, which allows to store all unicode characters. Potentially, a custom collation could be specified in an optional parameter.As far as I know, there are two ways to specify the collation:
collation-server
andcharacter_set_server
CREATE DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
.From the source code it seems that the SQL query does not specify any collation.
What's really odd is that
/etc/mysql/mariadb.conf.d/50-server.cnf
already specifies the default collation asutf8mb4_general_ci
(as seems to be standard on Debian), but it seems that this setting is not getting applied. What I suspect is that Yunohost specifies a custom/etc/mysql/mariadb.cnf
file that does not include the files from/etc/mysql/mariadb.conf.d
, but I don't know enough about Yunohost to tell if that's really the case.Workaround
I had success by running the following after creating the database: