From 72b37297e8fb5952a530becd1c679dcd6eb0a1bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= Date: Tue, 13 Aug 2024 14:39:39 +0200 Subject: [PATCH] [TASK] Raise `doctrine/dbal:^4.1` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Doctrine Team recently released minor version release `4.1.0` including a couple of bugfixes, internal changes and also new features [1]. The aforementioned internal changes introduces breaking stuff within internal implementation, for example the TYPO3 Database Analyzer stack enforcing adoption [2][3][4]. Sadly, it's not possible to provide backwards compatible code and thus minimum version raise is "absolutly" required. Doctrine DBAL 4.1.0 also includes new platform implementation for some database platforms and this change adds them as extend replacements to ensure working state with TYPO3 DB Analyzer. Note that previous TYPO3 v13.x composer instances needs to limit doctrine/dbal to 4.0.x on their own to avoid breaking behaviour. Used command(s): \ composer require --no-update --no-install \ -d typo3/sysext/redirects \ "doctrine/dbal":"^4.1" \ && composer require --no-update --no-install \ -d typo3/sysext/core \ "doctrine/dbal":"^4.1" \ && composer require --no-update --no-install \ -d typo3/sysext/install \ "doctrine/dbal":"^4.1" \ && composer require "doctrine/dbal":"^4.1" [1] https://github.com/doctrine/dbal/releases/tag/4.1.0 [2] https://github.com/doctrine/dbal/pull/6280 [3] https://github.com/doctrine/dbal/pull/6482 [4] https://github.com/doctrine/dbal/pull/6490 Resolves: #104628 Releases: main Change-Id: I53c86feed17abc6a90625e27fb135f606a57fc9f Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85620 Reviewed-by: Christian Kuhn Reviewed-by: Andreas Kienast Tested-by: core-ci Tested-by: Christian Kuhn Tested-by: Andreas Kienast Tested-by: Stefan Bürk Reviewed-by: Stefan Bürk --- composer.json | 2 +- composer.lock | 28 ++--- .../core/Classes/Database/Connection.php | 19 --- .../Driver/CustomPlatformDriverDecorator.php | 6 + .../Database/Platform/MariaDB1010Platform.php | 46 +++++++ .../Database/Platform/MySQL84Platform.php | 48 ++++++++ .../Database/Schema/ConnectionMigrator.php | 114 +++++++----------- .../Classes/Database/Schema/TableDiff.php | 31 ++--- .../Database/Schema/SchemaMigratorTest.php | 1 - .../Schema/ConnectionMigratorTest.php | 86 ++++++++----- typo3/sysext/core/composer.json | 2 +- typo3/sysext/install/composer.json | 2 +- typo3/sysext/redirects/composer.json | 2 +- 13 files changed, 229 insertions(+), 158 deletions(-) create mode 100644 typo3/sysext/core/Classes/Database/Platform/MariaDB1010Platform.php create mode 100644 typo3/sysext/core/Classes/Database/Platform/MySQL84Platform.php diff --git a/composer.json b/composer.json index b7945ae18331..593f95a67c5d 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ "bacon/bacon-qr-code": "^3.0", "christian-riesen/base32": "^1.6", "doctrine/annotations": "^1.13.3 || ^2.0", - "doctrine/dbal": "^4.0.2", + "doctrine/dbal": "^4.1", "doctrine/event-manager": "^2.0", "doctrine/instantiator": "^1.5 || ^2.0", "doctrine/lexer": "^3.0", diff --git a/composer.lock b/composer.lock index 9ab917f3aa14..c716fb99ac38 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0d2fb6045fa35e3dd4fae5df917f99fd", + "content-hash": "1b99e7dcd3289d7e4c8f80e25c4238ac", "packages": [ { "name": "bacon/bacon-qr-code", @@ -247,16 +247,16 @@ }, { "name": "doctrine/dbal", - "version": "4.0.2", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "61d79c6e379a39dc1fea6b4e50a23dfc3cd2076a" + "reference": "2377cd41609aa51bee822c8d207317a3f363a558" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/61d79c6e379a39dc1fea6b4e50a23dfc3cd2076a", - "reference": "61d79c6e379a39dc1fea6b4e50a23dfc3cd2076a", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/2377cd41609aa51bee822c8d207317a3f363a558", + "reference": "2377cd41609aa51bee822c8d207317a3f363a558", "shasum": "" }, "require": { @@ -269,16 +269,16 @@ "doctrine/coding-standard": "12.0.0", "fig/log-test": "^1", "jetbrains/phpstorm-stubs": "2023.2", - "phpstan/phpstan": "1.10.58", - "phpstan/phpstan-phpunit": "1.3.15", - "phpstan/phpstan-strict-rules": "^1.5", - "phpunit/phpunit": "10.5.9", - "psalm/plugin-phpunit": "0.18.4", + "phpstan/phpstan": "1.11.7", + "phpstan/phpstan-phpunit": "1.4.0", + "phpstan/phpstan-strict-rules": "^1.6", + "phpunit/phpunit": "10.5.28", + "psalm/plugin-phpunit": "0.19.0", "slevomat/coding-standard": "8.13.1", - "squizlabs/php_codesniffer": "3.9.0", + "squizlabs/php_codesniffer": "3.10.2", "symfony/cache": "^6.3.8|^7.0", "symfony/console": "^5.4|^6.3|^7.0", - "vimeo/psalm": "5.21.1" + "vimeo/psalm": "5.24.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -335,7 +335,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/4.0.2" + "source": "https://github.com/doctrine/dbal/tree/4.1.0" }, "funding": [ { @@ -351,7 +351,7 @@ "type": "tidelift" } ], - "time": "2024-04-25T08:29:52+00:00" + "time": "2024-08-15T07:37:07+00:00" }, { "name": "doctrine/deprecations", diff --git a/typo3/sysext/core/Classes/Database/Connection.php b/typo3/sysext/core/Classes/Database/Connection.php index b7d35de82498..1c43b45242b0 100644 --- a/typo3/sysext/core/Classes/Database/Connection.php +++ b/typo3/sysext/core/Classes/Database/Connection.php @@ -21,7 +21,6 @@ use Doctrine\DBAL\Configuration; use Doctrine\DBAL\Driver; use Doctrine\DBAL\Driver\Connection as ConnectionInterface; -use Doctrine\DBAL\Exception as DbalException; use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Platforms\MariaDBPlatform as DoctrineMariaDBPlatform; use Doctrine\DBAL\Platforms\MySQLPlatform as DoctrineMySQLPlatform; @@ -332,24 +331,6 @@ public function count(string $item, string $tableName, array $identifiers): int return (int)$query->executeQuery()->fetchOne(); } - /** - * Returns the version of the current platform if applicable. - * - * If no version information is available only the platform name will be shown. - * If the platform name is unknown or unsupported the driver name will be shown. - * - * @internal only and not part of public API. - */ - public function getServerVersion(): string - { - try { - return parent::getServerVersion(); - } catch (DbalException) { - } - // Return empty server version due to database connection error. - return ''; - } - /** * Returns the version of the current platform if applicable, containing the platform as prefix. * diff --git a/typo3/sysext/core/Classes/Database/Driver/CustomPlatformDriverDecorator.php b/typo3/sysext/core/Classes/Database/Driver/CustomPlatformDriverDecorator.php index e7ed7fe35e01..9ca47e987247 100644 --- a/typo3/sysext/core/Classes/Database/Driver/CustomPlatformDriverDecorator.php +++ b/typo3/sysext/core/Classes/Database/Driver/CustomPlatformDriverDecorator.php @@ -19,18 +19,22 @@ use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware; use Doctrine\DBAL\Platforms\AbstractPlatform; +use Doctrine\DBAL\Platforms\MariaDB1010Platform as DoctrineMariaDB1010Platform; use Doctrine\DBAL\Platforms\MariaDB1052Platform as DoctrineMariaDB1052Platform; use Doctrine\DBAL\Platforms\MariaDB1060Platform as DoctrineMariaDB1060Platform; use Doctrine\DBAL\Platforms\MariaDBPlatform as DoctrineMariaDBPlatform; use Doctrine\DBAL\Platforms\MySQL80Platform as DoctrineMySQL80Platform; +use Doctrine\DBAL\Platforms\MySQL84Platform as DoctrineMySQL84Platform; use Doctrine\DBAL\Platforms\MySQLPlatform as DoctrineMySQLPlatform; use Doctrine\DBAL\Platforms\PostgreSQLPlatform as DoctrinePostgreSQLPlatform; use Doctrine\DBAL\Platforms\SQLitePlatform as DoctrineSQLitePlatform; use Doctrine\DBAL\ServerVersionProvider; +use TYPO3\CMS\Core\Database\Platform\MariaDB1010Platform as Typo3MariaDB1010Platform; use TYPO3\CMS\Core\Database\Platform\MariaDB1052Platform as Typo3MariaDB1052Platform; use TYPO3\CMS\Core\Database\Platform\MariaDB1060Platform as Typo3MariaDB1060Platform; use TYPO3\CMS\Core\Database\Platform\MariaDBPlatform as Typo3MariaDBPlatform; use TYPO3\CMS\Core\Database\Platform\MySQL80Platform as Typo3MySQL80Platform; +use TYPO3\CMS\Core\Database\Platform\MySQL84Platform as Typo3MySQL84Platform; use TYPO3\CMS\Core\Database\Platform\MySQLPlatform as Typo3MySQLPlatform; use TYPO3\CMS\Core\Database\Platform\PostgreSQLPlatform as Typo3PostgreSQLPlatform; use TYPO3\CMS\Core\Database\Platform\SQLitePlatform as Typo3SQLitePlatform; @@ -58,9 +62,11 @@ private function elevatePlatform(AbstractPlatform $platform): AbstractPlatform return match ($platform::class) { DoctrineMySQLPlatform::class => new Typo3MySQLPlatform(), DoctrineMySQL80Platform::class => new Typo3MySQL80Platform(), + DoctrineMySQL84Platform::class => new Typo3MySQL84Platform(), DoctrineMariaDBPlatform::class => new Typo3MariaDBPlatform(), DoctrineMariaDB1052Platform::class => new Typo3MariaDB1052Platform(), DoctrineMariaDB1060Platform::class => new Typo3MariaDB1060Platform(), + DoctrineMariaDB1010Platform::class => new Typo3MariaDB1010Platform(), DoctrineSQLitePlatform::class => new Typo3SQLitePlatform(), DoctrinePostgreSQLPlatform::class => new Typo3PostgreSQLPlatform(), default => $platform, diff --git a/typo3/sysext/core/Classes/Database/Platform/MariaDB1010Platform.php b/typo3/sysext/core/Classes/Database/Platform/MariaDB1010Platform.php new file mode 100644 index 000000000000..2590c2d02d03 --- /dev/null +++ b/typo3/sysext/core/Classes/Database/Platform/MariaDB1010Platform.php @@ -0,0 +1,46 @@ + + */ + public function getAlterTableSQL(TableDiff|DoctrineTableDiff $diff): array + { + return $this->getCustomAlterTableSQLEngineOptions($this, $diff, parent::getAlterTableSQL($diff)); + } +} diff --git a/typo3/sysext/core/Classes/Database/Platform/MySQL84Platform.php b/typo3/sysext/core/Classes/Database/Platform/MySQL84Platform.php new file mode 100644 index 000000000000..09a39242817c --- /dev/null +++ b/typo3/sysext/core/Classes/Database/Platform/MySQL84Platform.php @@ -0,0 +1,48 @@ + + */ + public function getAlterTableSQL(TableDiff|DoctrineTableDiff $diff): array + { + return $this->getCustomAlterTableSQLEngineOptions($this, $diff, parent::getAlterTableSQL($diff)); + } +} diff --git a/typo3/sysext/core/Classes/Database/Schema/ConnectionMigrator.php b/typo3/sysext/core/Classes/Database/Schema/ConnectionMigrator.php index 4a35167bb003..867493ac65aa 100644 --- a/typo3/sysext/core/Classes/Database/Schema/ConnectionMigrator.php +++ b/typo3/sysext/core/Classes/Database/Schema/ConnectionMigrator.php @@ -139,13 +139,16 @@ public function install(bool $createOnly = false): array // With partial ext_tables.sql files the SchemaManager is detecting // existing columns as false positives for a column rename. In this // context every rename is actually a new column. - foreach ($changedTable->renamedColumns as $columnName => $renamedColumn) { - $changedTable->addedColumns[$renamedColumn->getName()] = new Column( - $renamedColumn->getName(), - $renamedColumn->getType(), - $this->prepareColumnOptions($renamedColumn) + foreach ($changedTable->changedColumns as $columnName => $changedColumn) { + if (!$changedColumn->hasNameChanged()) { + continue; + } + $changedTable->addedColumns[$changedColumn->getNewColumn()->getName()] = new Column( + $changedColumn->getNewColumn()->getName(), + $changedColumn->getNewColumn()->getType(), + $this->prepareColumnOptions($changedColumn->getNewColumn()) ); - unset($changedTable->renamedColumns[$columnName]); + unset($changedTable->changedColumns[$columnName]); } if ($createOnly) { @@ -160,12 +163,12 @@ static function (string $columnName): string { }, $addedIndex->getColumns() ); - $columnChanges = array_intersect($indexColumns, array_keys($changedTable->modifiedColumns)); + $columnChanges = array_intersect($indexColumns, array_keys($changedTable->changedColumns)); if (!empty($columnChanges)) { unset($schemaDiff->alteredTables[$key]->addedIndexes[$indexName]); } } - $schemaDiff->alteredTables[$key]->modifiedColumns = []; + $schemaDiff->alteredTables[$key]->changedColumns = []; $schemaDiff->alteredTables[$key]->modifiedIndexes = []; $schemaDiff->alteredTables[$key]->renamedIndexes = []; } @@ -388,12 +391,10 @@ protected function getNewFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff): ar $this->buildQuotedTable($changedTable->getOldTable()), // addedColumns [$columnName => $addedColumn], - // modifiedColumns + // changedColumns [], // droppedColumns [], - // renamedColumns - [], // addedIndexes [], // modifiedIndexes @@ -421,12 +422,10 @@ protected function getNewFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff): ar $this->buildQuotedTable($changedTable->getOldTable()), // addedColumns [], - // modifiedColumns + // changedColumns [], // droppedColumns [], - // renamedColumns - [], // addedIndexes [$indexName => $this->buildQuotedIndex($addedIndex)], // modifiedIndexes @@ -455,12 +454,10 @@ protected function getNewFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff): ar $this->buildQuotedTable($changedTable->getOldTable()), // addedColumns [], - // modifiedColumns + // changedColumns [], // droppedColumns [], - // renamedColumns - [], // addedIndexes [], // modifiedIndexes @@ -527,12 +524,10 @@ protected function getChangedTableOptions(Typo3SchemaDiff $schemaDiff): array $tableDiff->getOldTable(), // addedColumns [], - // modifiedColumns + // changedColumns [], // droppedColumns [], - // renamedColumns - [], // addedIndexes [], // modifiedIndexes @@ -600,12 +595,10 @@ protected function getChangedFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff) $changedTable->getOldTable(), // addedColumns [], - // modifiedColumns + // changedColumns [], // droppedColumns [], - // renamedColumns - [], // addedIndexes [], // modifiedIndexes @@ -657,12 +650,10 @@ protected function getChangedFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff) $changedTable->getOldTable(), // addedColumns [], - // modifiedColumns + // changedColumns [], // droppedColumns [], - // renamedColumns - [], // addedIndexes [], // modifiedIndexes @@ -713,12 +704,12 @@ protected function getChangedFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff) } } - if (count($changedTable->modifiedColumns) !== 0) { + if (count($changedTable->changedColumns) !== 0) { // Treat each changed column with a new diff to get a dedicated suggestions // just for this single column. - foreach ($changedTable->modifiedColumns as $columnName => $changedColumn) { + foreach ($changedTable->changedColumns as $columnName => $changedColumn) { // Field has been renamed and will be handled separately - if ($changedColumn->getOldColumn()->getName() !== $changedColumn->getNewColumn()->getName()) { + if ($changedColumn->hasNameChanged()) { continue; } @@ -739,12 +730,10 @@ protected function getChangedFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff) $this->buildQuotedTable($changedTable->getOldTable()), // addedColumns [], - // modifiedColumns + // changedColumns [$columnName => $changedColumn], // droppedColumns [], - // renamedColumns - [], // addedIndexes [], // modifiedIndexes @@ -823,12 +812,10 @@ protected function getChangedFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff) $changedTable->getOldTable(), // addedColumns [], - // modifiedColumns + // changedColumns [], // droppedColumns [], - // renamedColumns - [], // addedIndexes [], // modifiedIndexes @@ -926,15 +913,15 @@ protected function getUnusedFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff): $databasePlatform = $this->connection->getDatabasePlatform(); $changedTables = []; foreach ($schemaDiff->alteredTables as $tableName => $changedTable) { - if (count($changedTable->modifiedColumns) === 0) { + if (count($changedTable->changedColumns) === 0) { continue; } // Treat each changed column with a new diff to get a dedicated suggestions // just for this single column. - foreach ($changedTable->modifiedColumns as $index => $changedColumn) { + foreach ($changedTable->changedColumns as $index => $changedColumn) { // Field has not been renamed - if ($changedColumn->getOldColumn()->getName() === $changedColumn->getNewColumn()->getName()) { + if (!$changedColumn->hasNameChanged()) { continue; } @@ -944,12 +931,10 @@ protected function getUnusedFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff): $this->buildQuotedTable($changedTable->getOldTable()), // addedColumns [], - // modifiedColumns + // changedColumns [$oldFieldName => $changedColumn], // droppedColumns [], - // renamedColumns - [], // addedIndexes [], // modifiedIndexes @@ -965,9 +950,6 @@ protected function getUnusedFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff): // droppedForeignKeys [], ); - if ($databasePlatform instanceof DoctrinePostgreSQLPlatform) { - $renameColumnTableDiff->renamedColumns[$oldFieldName] = $changedColumn->getNewColumn(); - } $changedTables[$tableName . ':' . $changedColumn->getNewColumn()->getName()] = $renameColumnTableDiff; if ($databasePlatform instanceof DoctrineSQLitePlatform) { @@ -1027,12 +1009,10 @@ protected function getDropFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff): a $this->buildQuotedTable($changedTable->getOldTable()), // addedColumns [], - // modifiedColumns + // changedColumns [], // droppedColumns [$columnName => $this->buildQuotedColumn($removedColumn)], - // renamedColumns - [], // addedIndexes [], // modifiedIndexes @@ -1064,12 +1044,10 @@ protected function getDropFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff): a $this->buildQuotedTable($changedTable->getOldTable()), // addedColumns [], - // modifiedColumns + // changedColumns [], // droppedColumns [], - // renamedColumns - [], // addedIndexes [], // modifiedIndexes @@ -1102,12 +1080,10 @@ protected function getDropFieldUpdateSuggestions(Typo3SchemaDiff $schemaDiff): a $this->buildQuotedTable($changedTable->getOldTable()), // addedColumns [], - // modifiedColumns + // changedColumns [], // droppedColumns [], - // renamedColumns - [], // addedIndexes [], // modifiedIndexes @@ -1223,12 +1199,10 @@ protected function migrateUnprefixedRemovedTablesToRenames(Typo3SchemaDiff $sche $this->buildQuotedTable($removedTable), // addedColumns [], - // modifiedColumns + // changedColumns [], // droppedColumns [], - // renamedColumns - [], // addedIndexes [], // modifiedIndexes @@ -1294,7 +1268,7 @@ protected function migrateUnprefixedRemovedFieldsToRenames(Typo3SchemaDiff $sche $columnDiff = new Typo3ColumnDiff($this->buildQuotedColumn($removedColumn), $renamedColumn); // Add the column with the required rename information to the changed column list - $schemaDiff->alteredTables[$tableIndex]->modifiedColumns[$columnIndex] = $columnDiff; + $schemaDiff->alteredTables[$tableIndex]->changedColumns[$columnIndex] = $columnDiff; // Remove the column from the list of columns to be dropped unset($schemaDiff->alteredTables[$tableIndex]->droppedColumns[$columnIndex]); @@ -1314,26 +1288,28 @@ protected function migrateUnprefixedRemovedFieldsToRenames(Typo3SchemaDiff $sche protected function migrateColumnRenamesToDistinctActions(Typo3SchemaDiff $schemaDiff): Typo3SchemaDiff { foreach ($schemaDiff->alteredTables as $changedTable) { - if (count($changedTable->getRenamedColumns()) === 0) { + if (count($changedTable->getChangedColumns()) === 0) { continue; } // Treat each renamed column with a new diff to get a dedicated // suggestion just for this single column. - foreach ($changedTable->renamedColumns as $originalColumnName => $renamedColumn) { - $columnOptions = $this->prepareColumnOptions($renamedColumn); - $changedTable->addedColumns[$renamedColumn->getName()] = new Column( - $renamedColumn->getName(), - $renamedColumn->getType(), - $columnOptions + foreach ($changedTable->changedColumns as $originalColumnName => $changedColumn) { + if (!$changedColumn->hasNameChanged()) { + continue; + } + $changedTable->addedColumns[$changedColumn->getNewColumn()->getName()] = new Column( + $changedColumn->getNewColumn()->getName(), + $changedColumn->getNewColumn()->getType(), + $this->prepareColumnOptions($changedColumn->getNewColumn()) ); - $changedTable->droppedColumns[$originalColumnName] = new Column( - $originalColumnName, - $renamedColumn->getType(), - $columnOptions + $changedTable->droppedColumns[$changedColumn->getOldColumn()->getName()] = new Column( + $changedColumn->getOldColumn()->getName(), + $changedColumn->getOldColumn()->getType(), + $this->prepareColumnOptions($changedColumn->getOldColumn()) ); - unset($changedTable->renamedColumns[$originalColumnName]); + unset($changedTable->changedColumns[$originalColumnName]); } } diff --git a/typo3/sysext/core/Classes/Database/Schema/TableDiff.php b/typo3/sysext/core/Classes/Database/Schema/TableDiff.php index 218e49d21866..ae14de583e89 100644 --- a/typo3/sysext/core/Classes/Database/Schema/TableDiff.php +++ b/typo3/sysext/core/Classes/Database/Schema/TableDiff.php @@ -40,9 +40,8 @@ class TableDiff extends DoctrineTableDiff * Constructs a TableDiff object. * * @param array $addedColumns - * @param array $modifiedColumns + * @param array $changedColumns * @param array $droppedColumns - * @param array $renamedColumns * @param array $addedIndexes * @param array $modifiedIndexes * @param array $droppedIndexes @@ -59,9 +58,8 @@ class TableDiff extends DoctrineTableDiff public function __construct( public Table $oldTable, public array $addedColumns, - public array $modifiedColumns, + public array $changedColumns, public array $droppedColumns, - public array $renamedColumns, public array $addedIndexes, public array $modifiedIndexes, public array $droppedIndexes, @@ -124,9 +122,9 @@ public function getAddedColumns(): array } /** @return array */ - public function getModifiedColumns(): array + public function getChangedColumns(): array { - return $this->modifiedColumns; + return $this->changedColumns; } /** @return array */ @@ -135,12 +133,6 @@ public function getDroppedColumns(): array return $this->droppedColumns; } - /** @return array */ - public function getRenamedColumns(): array - { - return $this->renamedColumns; - } - /** @return array */ public function getAddedIndexes(): array { @@ -186,9 +178,8 @@ public function getDroppedForeignKeys(): array public function isEmpty(): bool { return count($this->getAddedColumns()) === 0 - && count($this->getModifiedColumns()) === 0 + && count($this->getChangedColumns()) === 0 && count($this->getDroppedColumns()) === 0 - && count($this->getRenamedColumns()) === 0 && count($this->getAddedIndexes()) === 0 && count($this->getModifiedIndexes()) === 0 && count($this->getDroppedIndexes()) === 0 @@ -217,12 +208,10 @@ public static function ensure(DoctrineTableDiff|TableDiff $tableDiff): self $tableDiff->getOldTable(), // addedColumns $tableDiff->getAddedColumns(), - // modifiedColumns + // changedColumns [], // droppedColumns $tableDiff->getDroppedColumns(), - // renamedColumns - $tableDiff->getRenamedColumns(), // addedIndexes $tableDiff->getAddedIndexes(), // modifiedIndexes @@ -244,12 +233,12 @@ public static function ensure(DoctrineTableDiff|TableDiff $tableDiff): self // doctrine/dbal 4+ removed the column name as array index for modified column definitions, // but we rely on it. Restore it ! // Ensure to use custom ColumnDiff instance with more data and - foreach ($tableDiff->getModifiedColumns() as $modifiedColumn) { - $diff->modifiedColumns[$modifiedColumn->getOldColumn()->getName()] = new ColumnDiff( + foreach ($tableDiff->getChangedColumns() as $changedColumn) { + $diff->changedColumns[$changedColumn->getOldColumn()->getName()] = new ColumnDiff( // oldColumn - $modifiedColumn->getOldColumn(), + $changedColumn->getOldColumn(), // newColumn - $modifiedColumn->getNewColumn(), + $changedColumn->getNewColumn(), ); } diff --git a/typo3/sysext/core/Tests/Functional/Database/Schema/SchemaMigratorTest.php b/typo3/sysext/core/Tests/Functional/Database/Schema/SchemaMigratorTest.php index 300bdb1cbc57..77152da6d33d 100644 --- a/typo3/sysext/core/Tests/Functional/Database/Schema/SchemaMigratorTest.php +++ b/typo3/sysext/core/Tests/Functional/Database/Schema/SchemaMigratorTest.php @@ -347,7 +347,6 @@ public function dropUnusedField(): void [], [], [], - [], ); $schemaDiff = new SchemaDiff( [], diff --git a/typo3/sysext/core/Tests/Unit/Database/Schema/ConnectionMigratorTest.php b/typo3/sysext/core/Tests/Unit/Database/Schema/ConnectionMigratorTest.php index f7bbcb7c6139..5b140b2e6a52 100644 --- a/typo3/sysext/core/Tests/Unit/Database/Schema/ConnectionMigratorTest.php +++ b/typo3/sysext/core/Tests/Unit/Database/Schema/ConnectionMigratorTest.php @@ -58,14 +58,22 @@ protected function setUp(): void public function tableNamesStickToTheMaximumCharactersWhenPrefixedForRemoval(): void { $originalSchemaDiff = new SchemaDiff( - createdSchemas: [], - droppedSchemas: [], - createdTables: [], - alteredTables: [], - droppedTables: [$this->getTable()->getName() => $this->getTable()], - createdSequences: [], - alteredSequences: [], - droppedSequences: [], + // createdSchemas + [], + // droppedSchemas + [], + // createdTables + [], + // alteredTables + [], + // droppedTables + [$this->getTable()->getName() => $this->getTable()], + // createdSequences + [], + // alteredSequences + [], + // droppedSequences + [], ); /** @var SchemaDiff $renamedSchemaDiff */ $renamedSchemaDiff = $this->subject->_call('migrateUnprefixedRemovedTablesToRenames', $originalSchemaDiff); @@ -81,33 +89,51 @@ public function columnNamesStickToTheMaximumCharactersWhenPrefixedForRemoval(): { $table = $this->getTable(); $tableDiff = new TableDiff( - oldTable: $table, - addedColumns: [], - modifiedColumns: [], - droppedColumns: [$this->getColumn()->getName() => $this->getColumn()], - renamedColumns: [], - addedIndexes: [], - modifiedIndexes: [], - droppedIndexes: [], - renamedIndexes: [], - addedForeignKeys: [], - modifiedForeignKeys: [], - droppedForeignKeys: [], + // oldTable + $table, + // addedColumns + [], + // changedColumns + [], + // droppedColumns + [$this->getColumn()->getName() => $this->getColumn()], + // addedIndexes + [], + // modifiedIndexes + [], + // droppedIndexes + [], + // renamedIndexes + [], + // addedForeignKeys + [], + // modifiedForeignKeys + [], + // droppedForeignKeys + [], ); $originalSchemaDiff = new SchemaDiff( - createdSchemas: [], - droppedSchemas: [], - createdTables: [], - alteredTables: [$tableDiff->getOldTable()->getName() => $tableDiff], - droppedTables: [], - createdSequences: [], - alteredSequences: [], - droppedSequences: [], + // createdSchemas + [], + // droppedSchemas + [], + // createdTables + [], + // alteredTables + [$tableDiff->getOldTable()->getName() => $tableDiff], + // droppedTables + [], + // createdSequences + [], + // alteredSequences + [], + // droppedSequences + [], ); /** @var SchemaDiff $renamedSchemaDiff */ $renamedSchemaDiff = $this->subject->_call('migrateUnprefixedRemovedFieldsToRenames', $originalSchemaDiff); - $firstColumnName = array_key_first($renamedSchemaDiff->getAlteredTables()[$table->getName()]->getModifiedColumns()); - $firstColumn = $renamedSchemaDiff->getAlteredTables()[$table->getName()]->getModifiedColumns()[$firstColumnName]; + $firstColumnName = array_key_first($renamedSchemaDiff->getAlteredTables()[$table->getName()]->getChangedColumns()); + $firstColumn = $renamedSchemaDiff->getAlteredTables()[$table->getName()]->getChangedColumns()[$firstColumnName]; self::assertStringStartsWith( 'zzz_deleted_', diff --git a/typo3/sysext/core/composer.json b/typo3/sysext/core/composer.json index 1851ea353d07..3a30d2140573 100644 --- a/typo3/sysext/core/composer.json +++ b/typo3/sysext/core/composer.json @@ -34,7 +34,7 @@ "bacon/bacon-qr-code": "^3.0", "christian-riesen/base32": "^1.6", "doctrine/annotations": "^1.13.3 || ^2.0", - "doctrine/dbal": "^4.0.2", + "doctrine/dbal": "^4.1", "doctrine/event-manager": "^2.0", "doctrine/lexer": "^3.0", "egulias/email-validator": "^4.0", diff --git a/typo3/sysext/install/composer.json b/typo3/sysext/install/composer.json index cd27071068a7..44113da9d594 100644 --- a/typo3/sysext/install/composer.json +++ b/typo3/sysext/install/composer.json @@ -19,7 +19,7 @@ "sort-packages": true }, "require": { - "doctrine/dbal": "^4.0.2", + "doctrine/dbal": "^4.1", "guzzlehttp/promises": "^2.0.3", "nikic/php-parser": "^5.0.1", "symfony/finder": "^7.1", diff --git a/typo3/sysext/redirects/composer.json b/typo3/sysext/redirects/composer.json index 4a0250440b32..fbbb295a9a35 100644 --- a/typo3/sysext/redirects/composer.json +++ b/typo3/sysext/redirects/composer.json @@ -19,7 +19,7 @@ "sort-packages": true }, "require": { - "doctrine/dbal": "^4.0.2", + "doctrine/dbal": "^4.1", "psr/http-message": "^1.1 || ^2.0", "psr/log": "^2.0 || ^3.0", "symfony/console": "^7.1",