-
Stefan Bürk authored
TYPO3 v13 requires Doctrine DBAL 4 and will be subsequently updated. Doctrine DBAL 4 is shipping with a few breaking changes, where most breaking stuff is coped and handled by the TYPO3 core and placed in internal API implementation and wrappings. However, minor breaking things on extended and provided API's are included and requires proper adoption by extensions. * [1] `AbstractPlatform::getName()` has been removed and `instance of` checks are required to be used instead. TYPO3 adopted this removal in the extended platform classes and does not provide a b/c for it. * [2] Doctrine DBAL dropped support for older RDBMS version, aligned the Platform class extend chain and removed not-supported version for PostgreSQL and MariaDB. TYPO3 extended platform implementation are aligned and platform replacement in the replacement driver middleware modified. * [3] Doctrine DBAL switched the casing (renaming) of some of the Platform classes, where the new casing has already been used for the extended classes. Due to the fact that aliased `use` import statement has been used, adjusting these casing is minimized to these places. * [4] `Connection::lastInsertId()` no longer accepts a sequence name. TYPO3 core `Connection::getLastInsertId()` implementation is aligned to match this and core usages has been replaced with a pre-patch except one oversight which is done now. * [5] Doctrine DBAL introducing replacement methods for the removed methods `QueryBuilder::resetQueryParam()` and `resetQueryParams()`, which are replaced at required places. Methods are removed on TYPO3 QueryBuilder to be aligned with Doctrine DBAL. * [6] Doctrine DBAL made QueryBuilder's state internal and therefore removed the QueryBuilder methods `getQueryParts()`, `getQueryPart()`, `getType()` and `getState()` along with the public class constants. Methods are removed from the TYPO3 QueryBuilder to align here with Doctrine DBAL. TYPO3 requires access to this internal state, mainly for the Extbase ORM handling and the ContentObjectRenderer. This is solved by introducing a internal `ConcreteQueryBuilder` ensuring a state duplication and adding internal marked public getter to the outer TYPO3 QueryBuilder. * [7] Doctrine DBAL removed schema compare APIs not taking the DB connection into account and suggest to use connection aware comparator instead. `TYPO3\CMS\Install\Database\PermissionsCheck` is modified to respect this change. * [8] Doctrine DBAL removed table renaming by using the `TableDiff` object and not creating corresponding DDL statements anymore. To compensate for this, the already extended `TableDiff` object get the `new name` information reintroduced, and the renaming SQL DDL is directly created at the required place in `ConnectionMigrator`. * [9] Deprecated `SchemaDiff::toSql()` and `toSaveSql()` are replaced with `AbstractPlatform::getAlterSchemaSQL()`. * [10] TYPO3 SchemaMigrator, ConnectionMigrator and Comparator are modified to cope with some modifications in Doctrine DBAL 4. This leads to the requirement that additional normalisation from the MySQL variant (ext_tables.sql) towards the target platform. SQLite autoincrement normalization is moved from SchemaMigrator into the connection migrator and additional MySQL/MariaDB, generic identifier and PostgreSQL normalization is added to cope with this fact. * [11] Due to dropped PostgreSQL 9.6 support Doctrine DBAL switched from `SERIAL` to `GENERATED IDENTITY COLUMN` as virtual autoincrement handling still using sequence tables under the hood. The implemented schema change created by Doctrine DBAL will not migrate the sequence relation correctly and leads to really bad issues. The suggested and documented way is to create and use a procedure to migrate this. This is not suitable for the TYPO3 way of doing the database changes, and the `ConnectionMigrator` is modified to create the update statements taken from the procedure and replacing the normal alter statements. Due to the lack of a good entry point to combine data migration with required DDL changes, this has been implemented as a hackish merged statement for the meanwhile. * \TYPO3\CMS\Core\Database\Platform\PlatformSaveAlterSchemaSQLTrait is removed as "not used anymore" and already mitigated. The required work on the database analyser involved classes revealed badly, that a complete overhaul and restructuring of the code in this area is mandatory but exceeds the scope if this change. Multiple todo comments have been added to make this clear and will be done later. This is possible because the code in this area is considerable internal versus the need to make the breaking change until the dot-zero sprint release. Used command(s): > \ composer req --no-update --no-install \ -d typo3/sysext/redirects \ "doctrine/dbal":"4.0.x-dev@dev" ; \ composer req --no-update --no-install \ -d typo3/sysext/core \ "doctrine/dbal":"4.0.x-dev@dev" ; \ composer req --no-update --no-install \ -d typo3/sysext/install \ "doctrine/dbal":"4.0.x-dev@dev" ; \ composer req -W \ "doctrine/dbal":"4.0.x-dev@dev" ; \ COMPOSER=composer.dist.json composer req --no-update \ -d Build/composer \ "doctrine/dbal":"4.0.x-dev@dev" > Build/Scripts/runTests.sh -s phpstanGenerateBaseline [1] https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#bc-break-doctrinedbaldrivergetname-removed https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#bc-break-removed-support-for-postgresql-93-and-older [2] https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#bc-break-removed-support-for-mariadb-100-and-older https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#bc-break-removed-support-for-mysql-56-and-older [3] https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#bc-break-renamed-sqlite-platform-classes [4] https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#removed-support-for-connectionlastinsertidname [5] https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#deprecated-reset-methods-from-querybuilder [6] https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#deprecated-getting-query-parts-from-querybuilder https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#deprecated-querybuilder-methods-and-constants [7] https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#bc-break-removed-schema-comparison-apis-that-dont-account-for-the-current-database-connection-and-the-database-platform [8] https://github.com/doctrine/dbal/blob/3.7.x/UPGRADE.md#deprecated-renaming-tables-via-tablediff-and-abstractplatformaltertable [9] https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#deprecated-schemadifftosql-and-schemadifftosavesql [10] https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#bc-break-changes-in-handling-string-and-binary-columns [11] https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#bc-break-auto-increment-columns-on-postgresql-are-implemented-as-identity-not-serial https://github.com/doctrine/dbal/blob/4.0.x/docs/en/how-to/postgresql-identity-migration.rst Resolves: #102875 Related: #102589 Related: #102402 Releases: main Change-Id: I547928b5ebba55e574d3a992e864784d8f594653 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77709 Tested-by:
Oliver Klee <typo3-coding@oliverklee.de> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Benni Mack <benni@typo3.org>
8af1c49d