From 250a12f097f5f416f7350a9eb49f266fd26b6a91 Mon Sep 17 00:00:00 2001 From: David Losada Carballo Date: Mon, 11 Nov 2024 17:47:12 +0100 Subject: [PATCH] chore: set collation specific to mariadb and fix phinx configuration --- docker-compose.yml | 3 ++- phinx.php | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index caa0d6cdae..2be975535f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,9 +7,10 @@ services: MARIADB_DATABASE: ushahidi MARIADB_USER: ushahidi MARIADB_PASSWORD: ushahidi + LANG: C.UTF_8 command: - --character-set-server=utf8mb4 - - --collation-server=utf8mb4_unicode_ci + - --collation-server=utf8mb4_unicode_520_ci # mysql 8.0 # - --default-authentication-plugin=mysql_native_password ports: diff --git a/phinx.php b/phinx.php index 1b4fd50496..a2c86b74ec 100644 --- a/phinx.php +++ b/phinx.php @@ -15,7 +15,14 @@ 'user' => getenv('DB_USERNAME'), 'pass' => getenv('DB_PASSWORD'), 'unix_socket' => getenv('DB_SOCKET'), - 'charset' => 'utf8', + // afaik, phinx doesn't really use this for table creation in v0.11.7 + // apparently it's used as a connection parameter + 'charset' => 'utf8mb4', + // phinx guesses the charset to create the table with from this + // defaults to MariaDB's utf8mb4_unicode_520_ci, which is not supported by MySQL + // for MySQL you would want to use utf8mb4_0900_ai_ci (MySQL 8.0.17+) + // if you are stuck with MySQL 5.7, you can use utf8mb4_unicode_ci + 'collation' => getenv('DB_COLLATION') ?: 'utf8mb4_unicode_520_ci' ], ] ];