Skip to content

IBX-11939: Skipped the MariaDB JSON conversion on columns that are already JSON - #875

Draft
Steveb-p wants to merge 2 commits into
IBX-11939-json-conversion-check-5.0from
feature/schema-migration-guards-5.0
Draft

Steveb-p wants to merge 2 commits into
IBX-11939-json-conversion-check-5.0from
feature/schema-migration-guards-5.0

Conversation

@Steveb-p

@Steveb-p Steveb-p commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Note

Parked as a draft, to come back to later.

🎫 Issue IBX-11939

Related PRs:

Description:

Brings back a check before ConvertMariaDbJsonColumnsMigration runs sql/convert-json-columns-mariadb.sql.

Doctrine Migrations isn't mandatory on 5.0 yet, so a site installed through SchemaBuilderEvent can run ibexa:doctrine:migrations:migrate later. Its columns are JSON already, so the MODIFY statements change nothing: on MariaDB 10.11 they're all accepted with ALGORITHM=INSTANT, and SHOW CREATE TABLE stays byte-identical. Still, each one is an ALTER TABLE that briefly takes an exclusive metadata lock, and it waits behind any long-running transaction on that table. With the check, those sites get no ALTER at all.

The check isn't the one from #787 brought back. It looks for the json_valid() constraint MariaDB gives a JSON column on every column the file converts, not only the last one. It reads information_schema.CHECK_CONSTRAINTS, because Doctrine's Schema can't tell the difference on 5.0: DBAL 3 goes by the (DC2Type:json) comment, which the LONGTEXT columns from 4.6 have too, and reports both as JSON.

The trade-off: a fresh migrations install skips the statements as well, because it creates the columns in their final form. So nothing that only checks fresh installs, such as the schema alignment test if it ever runs on MariaDB, covers the SQL file anymore.

Checked on MariaDB 10.11 by running the migrations directly: skipped on fresh 5.0 installs through either path and on a re-run, run on a 4.6 database (identical to a fresh 5.0 install afterwards, data kept), and invalid JSON still fails the conversion.

…ready JSON

A database installed with SchemaBuilderEvent and migrated later has these
columns as JSON already, so the conversion has nothing to do there. The
check looks for the json_valid() constraint MariaDB gives a JSON column, on
every column the file converts. It reads information_schema, because
Doctrine DBAL 3 reports a 4.6 LONGTEXT column with a "(DC2Type:json)"
comment as JSON too.
It maps each table to the JSON column converted in it.
@Steveb-p
Steveb-p force-pushed the feature/schema-migration-guards-5.0 branch from 341de9c to 59f7ac6 Compare October 27, 2026 10:14
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant