Issue Task Under Review Stale

#110429Remove the array shaped schema migrator API

Stefan Bürk 08/11/26, 01:25 updated 09/02/26, 13:16

Description

SchemaMigrator::getUpdateSuggestions() reports statements grouped by operation kind and keyed by their own md5 hash, and migrate() executes a selection of those hashes one statement at a time. That model is what allows a table to be left in a state it cannot be left in, and every consumer has to re-derive from the array keys what is safe. With every consumer on the new API, nothing uses it anymore.

Removed with it

  • the suggestion building half of ConnectionMigrator, which is only the schema comparison afterwards and is renamed to ConnectionSchemaComparator accordingly,
  • Schema\TableDiff, Schema\SchemaDiff and Schema\Comparator, the mutable copies of doctrine classes the in place comparison needed. Two PHPStan baseline entries disappear with them; both said that TYPO3 extends a class doctrine marks as final.

The last consumers

DatabaseUpgradeWizardsService::addMissingTablesAndFields() and SetupDatabaseService::importDatabaseData() apply everything that removes nothing and report per table rather than per statement, and AbstractSchemaBasedTestCase gained applySafeChanges() and applyRemoval() for the same reason.

SchemaMigrator::install() stays here, as a wrapper around applySafe(), and only loses its create only argument, which no caller passes. Dropping create only mode is a behaviour change worth stating on its own: it left column and index changes of a table out, and a table is changed as a whole now. That is what makes repeated runs converge – skipping a table because it also needs a column change left the missing column missing, and getBlockingDatabaseAdds() reporting it forever. Three tests asserted the removed behaviour and are rewritten rather than dropped, including a split into an all platform and a MySQL only case: the fixture behind it indexes a text column by prefix length, which SQLite and PostgreSQL do not support.

ConnectionSchemaComparator becomes a stateless service

It used to be constructed per connection and per run, holding the connection name, the connection and the expected tables as properties, which is what an object per comparison needs but a service must not have. It now takes only the ConnectionPool and receives everything that varies between two runs as one immutable Dto\SchemaComparisonRequest passed to compare(). The deletion prefix becomes a constant and the class becomes readonly. Three private helpers had no caller left and are removed with it, including the one that threw a generic RuntimeException.

Breaking

This one is breaking for anything that called the schema migrator directly, so it is documented as such – two Breaking changelogs, and the commit carries the exclamation mark flag.

The distinction against sub-task 5, which was demoted from Breaking to Important, is use, not annotation: both layers are annotated internal@, but the platform classes were not reached from outside, while this API was the entry point extensions actually used.

Patch

Gerrit 95194, topic database-analyzer.

Releases: main

Reviews 1

History 012