Skip to content

IBX-11939: Ignored declared TEXT and BLOB defaults on MySQL in the schema alignment test - #82

Merged
Steveb-p merged 1 commit into
5.0from
fix/mysql-text-default-5.0
Nov 3, 2026
Merged

Steveb-p merged 1 commit into
5.0from
fix/mysql-text-default-5.0

Conversation

@Steveb-p

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

Copy link
Copy Markdown
Collaborator

Note

Stacked on #81. Review/land that one first, then this gets retargeted to 5.0.

🎫 Issue IBX-11939

Description:

On 5.0, SchemaAlignmentTest fails on MySQL in every package whose kernel includes product-catalog, on both install paths:

ALTER TABLE ibexa_catalog CHANGE query_string query_string LONGTEXT NOT NULL

product-catalog's schema.yaml declares query_string as text with default: ''. MySQL can't store a default on a TEXT or BLOB column, so DBAL creates the column without it (AbstractMySQLPlatform::getDefaultValueDeclarationSQL()), and the database reads it back without one. Both DBAL versions' comparators see that difference, but DBAL 2.13 then skipped it in MySqlPlatform::getAlterTableSQL() ("Don't propagate default value changes for unsupported column types"). DBAL 3 doesn't, so the plain comparison gives an ALTER that changes nothing. That's why 4.6 never hit it.

So there's a fifth rule, ignoreTextDefaultOnMySql(): on MySQL the declared default of a TEXT/BLOB column is dropped before comparing. MariaDB stores such defaults (MariaDBPlatform overrides that method), so it's still compared there - product-catalog's AddMariaDbQueryStringDefaultMigration relies on that.

I've also tried switching to DBAL 3's platform-aware comparator (new Comparator($platform) + getAlterSchemaSQL()) instead. It does drop this one, but it reports a lot of new differences on MySQL and SQLite (VARCHAR columns, DC2Type comments, a whole SQLite table rebuild), so a single rule seemed the lesser change.

Like the other rules, the case is in _fixtures/schema.yaml. SchemaAlignmentNormalizationTest now tells MariaDB apart from MySQL (getName() calls both mysql), and the unit test checks that MariaDB still reports a missing default.

Checked locally: unit tests, PHPStan, CS, and the integration suite on SQLite, MySQL 8.0, MariaDB 10.11 and PostgreSQL 14. measurement's 4.6 → 5.0 merge-up passes on MySQL on both paths with it.

Needed by the 4.6 → 5.0 merge-ups whose kernels include product-catalog (cart, corporate-account, measurement, order-management, payment, product-catalog, shipping); their TEMPORARY dependencies.json will point here.

For QA:

No QA required.

Documentation:

No documentation required.

@Steveb-p
Steveb-p added this pull request to stack #83 October 30, 2026 15:42
@Steveb-p
Steveb-p marked this pull request as ready for review October 30, 2026 15:52
Base automatically changed from fix/native-session-handler-5.0 to 5.0 November 3, 2026 11:18
…hema alignment test

MySQL can't store a default on a TEXT or BLOB column, so DBAL creates the column without the
declared one. DBAL 2.13 left the difference out of its ALTER statements; DBAL 3's comparator
reports it as 'ALTER TABLE ibexa_catalog CHANGE query_string query_string LONGTEXT NOT NULL',
which changes nothing. MariaDB stores the default, so it's still compared there.
@Steveb-p
Steveb-p force-pushed the fix/mysql-text-default-5.0 branch from cc7a32c to 0a065f1 Compare November 3, 2026 11:18
@Steveb-p
Steveb-p merged commit b72b1f2 into 5.0 Nov 3, 2026
4 of 5 checks passed
@Steveb-p
Steveb-p deleted the fix/mysql-text-default-5.0 branch November 3, 2026 11:19
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.

2 participants