Skip to content
Snippets Groups Projects
Commit 79ba5d29 authored by Stefan Bürk's avatar Stefan Bürk
Browse files

[TASK] Mitigate deprecated doctrine `SchemaDiff` methods

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

Resolves: #102592
Related: #102402
Releases: main
Change-Id: I8d9cd7e368ec68e2d5b54ec960d2200342180586
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82076


Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
parent cf7acb12
Branches
Tags
No related merge requests found
Showing
with 92 additions and 18 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment