Review main Merged

82076[TASK] Mitigate deprecated doctrine `SchemaDiff` methods

Stefan Bürk CR +2 V +2 Normal +92 −18 updated 12/18/23, 11:27

Commit message

The doctrine team deprecated the `SchemaDiff->toSql()` and
`SchemaDiff->toSaveSql()` methods [1], `toSaveSql()` without
a replacement.

Both methods are used in the TYPO3 database analyzer build
up - and the behaviour of replaceless deprecated `toSaveSql()`
is a essential used feature. In the current state there is
no good solution to mitigate this, therefore a temporary
`getSaveAlterSchemaSQL()` should be added as a wrapper. For
now dispatch to the deprecated `SchemaDiff->toSaveSql()` and
replace the body with corresponding code during the upgrade
for `Doctrine DBAL 4` - marked with a todo comment.

The whole schema and connection migrator implementation
is scheduled for a refactoring due to needs of further features,
so postpone a refactoring now and use this smelly hack.

This change ...

* adds a trait `PlatformSaveAlterSchemaSQLTrait` providing the
  `getSaveAlterSchemaSQL()` wrapper method.
* adds the trait `PlatformSaveAlterSchemaSQLTrait` to all
  extended platform classes (#102402).
* replaces deprecated `SchemaDiff->toSql()` calls with
  `AbstractPlatform::getAlterSchemaSQL()`.
* replace `SchemaDiff->toSaveSql()` calls with extended
  platform method `AbstractPlatform::getSaveAlterSchemaSQL()`.

[1] https://github.com/doctrine/dbal/blob/3.7.x/UPGRADE.md#deprecated-schemadifftosql-and-schemadifftosavesql

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 2

Files 14