Review main Work in progress Stale

95189[WIP][TASK] Use non-deprecated doctrine introspection API

Stefan Bürk CR 0 V 0 Expert +450 −599 updated 09/02/26, 13:27

Commit message

TYPO3 customized database schema introspection by overriding the
`_getPortable*()` hooks in extended doctrine schema managers, which
restored behaviour `doctrine/dbal 4` had removed together with the
doctrine event system.

Those hooks belong to `AbstractSchemaManager::listTables()`, which
`doctrine/dbal 4.4` marks as deprecated in favour of the new
`introspect*()` API. The replacement path resolves metadata through
`AbstractPlatform::createMetadataProvider()` and never calls the
legacy hooks. As soon as the deprecated path is removed upstream,
the TYPO3 customization would stop being applied silently: column
comments would no longer override doctrine types, `SET` values and
MySQL index prefix lengths would be lost from the comparison, all
without raising an error.

Introspection is therefore moved to the `introspect*()` API:

* `ConnectionMigrator` no longer calls `introspectSchema()`, which
  still routes through `listTables()`, and assembles the schema from
  `introspectTables()` and `introspectSequences()` instead.
* `SchemaInformation` uses `introspectTableColumnsByUnquotedName()`
  instead of the deprecated `listTableColumns()`.
* The extended schema managers post-process the introspected tables
  and columns instead of overriding the removed hooks. Doctrine
  columns are mutable, so nothing has to be rebuilt for this.

Decorating the platform metadata provider would have been the more
direct extension point, but is not possible: the platforms narrow
the return type of `createMetadataProvider()` to their concrete
provider class, and those are declared `final readonly`.

Two adjustments are needed to keep the comparison result identical:

* `SET` column values are not carried on the introspected column and
  are read from `information_schema` separately. The query is only
  issued for tables actually using a `SET` column.
* MySQL index prefix lengths are reported as a separate `lengths`
  index option, while TYPO3 compares them concatenated to the column
  name, matching the `ext_tables.sql` notation.

`introspectTables()` reports index columns as the statement that
created them spelled them, where the deprecated path normalized them
away. On SQLite that is enough to make a schema update never finish:
it rebuilds a table to alter it, works out which indexes the rebuilt
table keeps by resolving their columns against the columns of the
table, and drops the ones it cannot resolve although they were no
part of the change. The next comparison offers them again and that
rebuild drops the ones just added. Index columns are therefore
normalized where the current schema is read, and only there - the
expected side stays quoted, because PostgreSQL folds an unquoted
identifier to lower case.

This change prepares the ongoing streamlining of the database
analyzer stack, and is useful on its own.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 11
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/89/95189/11 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/89/95189/11 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Relation chain 8

  1. main 95195[WIP][!!!][TASK] Remove SchemaMigrator::install() Based on this change Work in progress Merge conflict Stefan Bürk CR 0 V 0 database-analyzer Normal +62 −37
  2. main 95194[WIP][!!!][TASK] Remove the array shaped schema migrator API Based on this change Work in progress Merge conflict Stefan Bürk CR 0 V 0 database-analyzer Nightmare +1441 −3637
  3. main 95193[WIP][FEATURE] Add database schema update command Based on this change Work in progress Stefan Bürk CR 0 V 0 database-analyzer Expert +1066 −0
  4. main 95192[WIP][TASK] Rework database analyzer stack Based on this change Work in progress Merge conflict Stefan Bürk CR 0 V 0 database-analyzer Nightmare +5239 −372
  5. main 95191[WIP][TASK] Generate table option changes without platform hooks Based on this change Work in progress Stefan Bürk CR 0 V 0 database-analyzer Hard +92 −282
  6. main 95190[WIP][TASK] Reduce column type comment handling to MySQL Based on this change Work in progress Stefan Bürk CR 0 V 0 database-analyzer Normal +50 −105
  7. 95189 [WIP][TASK] Use non-deprecated doctrine introspection API This change

  8. main 95263[TASK] Raise doctrine/dbal to ~4.4.4 This change is based on it Merged Stefan Bürk CR +2 V +2 → 14.3, 13.4 database-analyzer Normal +57 −5

Merge conflicts 4

Issues 2

Files 11

Review log 1224

  1. Stefan Bürk uploaded patch set 1 08/09/26, 21:00

  2. core-ci voted on patch set 1 V +1 08/09/26, 21:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106229

  3. Stefan Bürk rebased onto patch set 2 V +1 08/11/26, 00:32

  4. core-ci voted on patch set 2 V +1 08/11/26, 00:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106353

  5. Stefan Bürk rebased onto patch set 3 V +1 08/11/26, 04:00

  6. core-ci voted on patch set 3 V +1 08/11/26, 04:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106368

  7. Stefan Bürk rebased onto patch set 4 V +1 08/11/26, 05:17

  8. core-ci voted on patch set 4 V -1 08/11/26, 05:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106387

  9. core-ci voted on patch set 4 V +1 08/11/26, 10:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106387

  10. Stefan Bürk rebased onto patch set 5 V +1 08/11/26, 11:38

  11. core-ci voted on patch set 5 V +1 08/11/26, 11:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106418

  12. Stefan Bürk rebased onto patch set 6 V +1 08/11/26, 13:29

  13. core-ci voted on patch set 6 V +1 08/11/26, 13:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106434

  14. Stefan Bürk uploaded patch set 7 08/11/26, 14:14

    Copied Votes: * Verified+1 (copy condition: "**changekind:NO_CHANGE**")
  15. core-ci voted on patch set 7 V +1 08/11/26, 14:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106448

  16. Stefan Bürk rebased onto patch set 8 V +1 08/14/26, 20:48

  17. core-ci voted on patch set 8 V +1 08/14/26, 21:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106724

  18. Stefan Bürk rebased onto patch set 9 V +1 08/31/26, 10:28

  19. core-ci voted on patch set 9 V +1 08/31/26, 10:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107408

  20. Stefan Bürk rebased onto patch set 10 V +1 09/02/26, 10:40

  21. core-ci voted on patch set 10 V +1 09/02/26, 11:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107593

  22. Oliver Klee voted on patch set 10 V +1 09/02/26, 13:07

  23. Stefan Bürk rebased onto patch set 11 V +1 09/02/26, 13:16

  24. core-ci voted on patch set 11 V +1 09/02/26, 13:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107628