Files
romm/backend
Georges-Antoine Assi 5aab87e806 fix(db): cast JSON_TYPE before comparing it in age-rating expressions
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>
2026-09-06 08:28:37 -04:00
..
2026-07-01 08:58:00 -04:00
2024-02-10 12:43:39 -05:00
2025-07-05 19:17:40 -04:00
2026-05-17 17:39:47 -04:00