mirror of
https://github.com/rommapp/romm.git
synced 2026-12-02 10:08:40 +01:00
MariaDB pins the return collation of JSON_TYPE to utf8mb3_general_ci. In a generated-column expression the literal it is compared against inherits the table's collation instead of the connection's, so on a server started with --character-set-server=utf8 --collation-server=utf8_unicode_ci the roms table is utf8mb3_unicode_ci and the comparison is an illegal mix of two COERCIBLE utf8mb3 collations. Migration 0098 then aborts and the app never starts. CAST(... AS CHAR) re-derives the collation from the surrounding context, so the comparison resolves on any table collation. The same pattern in the roms_metadata views of 0074 and the 0098 downgrade is hardened too; it only survives today because view literals resolve under the utf8mb4 connection. Verified against ghcr.io/mariadb/mariadb:12.2.2-noble with the reporter's charset flags: alembic upgrade head fails at 0098 without this change, and reaches head with it, both from scratch and resuming a DB left at the failure. Fixes #4350 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>