Review main Merged

83934[BUGFIX] Ensure table definition overrides work again

Stefan Bürk CR +2 V +2 Normal +55 −2 updated 04/19/24, 12:26

Commit message

Doctrine DBAL 4.x has been introduced with #102875 and
required adoption of breaking changes - which had been
done. This included changes of children structures in
classes, for example `\Doctrine\DBAL\Schema\Table` no
longer returns associative array for `getColumns()` and
`getIndexes()`.

TYPO3 builds a virtual database schema reading extension
`ext_tables.sql` files combined with TCA based default
schema definitions to provide the Database Analyzer flow.
The collection process build up partly table structures,
and having tables multiple time which needs to be merged
at some point to get the final virtual structure. With
change #103015 this merge process has been moved to an
earlier point, overseeing that columns and indexes are
no longer associative arrays and using `array_merge()`
is no longer suitable for them.

In cases, where an extensions change or overrides the
table definition of a table this merge process will
throw a Doctrine DBAL `ColumnAlreadyExists` exception,
because columns and indexes of multiple table parts
are not correctly merged anymore.

This change introduces two helper method as sidekicks
for method `SchemaMigrator::mergeTableDefinitions()`,
to merge table columns and indexes correctly and guard
it with the added test.

Note: Foreign keys constraints are still associative,
and the TYPO3 does not support unique constraints at
all within `ext_tables.sql` files.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Christian Kuhn +1
    • Nikita Hovratov +1
    • Jörg Bösche +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Christian Kuhn +1
    • Nikita Hovratov +1
    • core-ci +1 CI

Issues 3

Files 2

Review log 811

  1. Stefan Bürk uploaded patch set 1 04/19/24, 09:30

  2. core-ci voted on patch set 1 V +1 04/19/24, 09:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56322

  3. core-ci commented on patch set 1 04/19/24, 10:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56324

  4. Nikita Hovratov uploaded patch set 2 V +1 04/19/24, 10:04

  5. Nikita Hovratov commented on patch set 2 CR +1 V +1 04/19/24, 10:05

    Changed Closure::bind to ReflectionMethod. Hope it's fine.
  6. core-ci voted on patch set 2 V +1 04/19/24, 10:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56325

  7. Stefan Bürk commented on patch set 2 04/19/24, 10:21

    Reply

    Why ? No need for a reflection here. In the end, it works.
  8. Christian Kuhn commented on patch set 2 CR +1 V +1 04/19/24, 12:14

    Reply

    calling the private method via reflection is imho more clean that the closure.
  9. Jörg Bösche voted on patch set 2 CR +1 04/19/24, 12:19

  10. Stefan Bürk voted on patch set 2 CR +2 V +2 04/19/24, 12:26

  11. Stefan Bürk merged patch set 3 04/19/24, 12:26