From 5b588f89a2addf5970d190a8b8f9f4b578cb0c9c Mon Sep 17 00:00:00 2001 From: berkut1 Date: Wed, 5 Jun 2024 23:24:38 +0300 Subject: [PATCH 1/9] Fix: Skip type comparison if disableTypeComments is true --- src/Platforms/AbstractPlatform.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index 49e131552ba..928a5a02121 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -4693,6 +4693,11 @@ public function columnsEqual(Column $column1, Column $column2): bool return false; } + // If disableTypeComments is true, we do not need to check types, all comparison is already done above + if ($this->disableTypeComments) { + return true; + } + return $column1->getType() === $column2->getType(); } From 50a3bd1dc44e517f3c45cd8a980ceac5ecefa6f3 Mon Sep 17 00:00:00 2001 From: berkut1 Date: Thu, 6 Jun 2024 03:01:48 +0300 Subject: [PATCH 2/9] add test --- tests/Platforms/AbstractPlatformTestCase.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/Platforms/AbstractPlatformTestCase.php b/tests/Platforms/AbstractPlatformTestCase.php index feabb6eb384..da4d8c886cb 100644 --- a/tests/Platforms/AbstractPlatformTestCase.php +++ b/tests/Platforms/AbstractPlatformTestCase.php @@ -1445,6 +1445,18 @@ public function testEmptySchemaDiff(): void self::assertSame([], $this->platform->getAlterSchemaSQL($diff)); } + public function testColumnComparisonWithDisabledTypeComments(): void + { + //Since DATETIME_MUTABLE is a "parent" of DATETIME_IMMUTABLE, they will have the same SQL type declaration. + $column1 = new Column('foo', Type::getType(Types::DATETIME_MUTABLE)); + $column2 = new Column('foo', Type::getType(Types::DATETIME_IMMUTABLE)); + + $this->platform->setDisableTypeComments(true); + $result = (new Comparator($this->platform))->columnsEqual($column1, $column2); + + self::assertTrue($result); + } + public function tearDown(): void { if (! isset($this->backedUpType)) { From f143f7f4901fbee501846856b785c477f4db832c Mon Sep 17 00:00:00 2001 From: Gennadij Date: Thu, 6 Jun 2024 22:52:32 +0300 Subject: [PATCH 3/9] Update tests/Platforms/AbstractPlatformTestCase.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Grégoire Paris --- tests/Platforms/AbstractPlatformTestCase.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Platforms/AbstractPlatformTestCase.php b/tests/Platforms/AbstractPlatformTestCase.php index da4d8c886cb..85e6b817434 100644 --- a/tests/Platforms/AbstractPlatformTestCase.php +++ b/tests/Platforms/AbstractPlatformTestCase.php @@ -1451,10 +1451,10 @@ public function testColumnComparisonWithDisabledTypeComments(): void $column1 = new Column('foo', Type::getType(Types::DATETIME_MUTABLE)); $column2 = new Column('foo', Type::getType(Types::DATETIME_IMMUTABLE)); - $this->platform->setDisableTypeComments(true); - $result = (new Comparator($this->platform))->columnsEqual($column1, $column2); + self::assertFalse($this->platform->columnsEqual($column1, $column2)); - self::assertTrue($result); + $this->platform->setDisableTypeComments(true); + self::assertTrue($this->platform->columnsEqual($column1, $column2)); } public function tearDown(): void From 630c44cfbfa9aec74af76cd3976f02b4b6ce4dcc Mon Sep 17 00:00:00 2001 From: Gennadij Date: Thu, 6 Jun 2024 22:52:42 +0300 Subject: [PATCH 4/9] Update tests/Platforms/AbstractPlatformTestCase.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Grégoire Paris --- tests/Platforms/AbstractPlatformTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Platforms/AbstractPlatformTestCase.php b/tests/Platforms/AbstractPlatformTestCase.php index 85e6b817434..a6e998b244d 100644 --- a/tests/Platforms/AbstractPlatformTestCase.php +++ b/tests/Platforms/AbstractPlatformTestCase.php @@ -1445,7 +1445,7 @@ public function testEmptySchemaDiff(): void self::assertSame([], $this->platform->getAlterSchemaSQL($diff)); } - public function testColumnComparisonWithDisabledTypeComments(): void + public function testColumnComparison(): void { //Since DATETIME_MUTABLE is a "parent" of DATETIME_IMMUTABLE, they will have the same SQL type declaration. $column1 = new Column('foo', Type::getType(Types::DATETIME_MUTABLE)); From 1a0a211f37af80510a52f77738c55436e0611825 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Fri, 7 Jun 2024 16:05:40 +0200 Subject: [PATCH 5/9] Fix the portability documentation (#6429) | Q | A |------------- | ----------- | Type | documentation | Fixed issues | n/a #### Summary The Portability connection is not a valid wrapper class as it does not extend `Doctrine\DBAL\Connection`. The way to use it is through the middleware, to wrap the driver connection. --- docs/en/reference/portability.rst | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/en/reference/portability.rst b/docs/en/reference/portability.rst index 65dc5148db0..3eaf8ae2267 100644 --- a/docs/en/reference/portability.rst +++ b/docs/en/reference/portability.rst @@ -51,15 +51,16 @@ Using the following code block in your initialization will: setMiddlewares([ + // Other middlewares //... - 'wrapperClass' => PortableConnection::class, - 'portability' => PortableConnection::PORTABILITY_ALL, - 'fetch_case' => ColumnCase::LOWER, - ]; + new PortableMiddleware(PortableConnection::PORTABILITY_ALL, ColumnCase::LOWER), + ]); This sort of portability handling is pretty expensive because all the result rows and columns have to be looped inside PHP before being returned to you. From 4aa9cf9cc5ee0bcf9fe3c180863f251556c4b839 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 8 Jun 2024 00:05:59 +1000 Subject: [PATCH 6/9] Fix MariaDB fetching of default table character-set (#6361) (#6425) | Q | A |------------- | ----------- | Type | bug | Fixed issues | #6361 #### Summary From MariaDB-10.10.1, where uca1400 was added, the information_schema.COLLATION_CHARACTER_SET_APPLICABILITY was extended to have FULL_COLLATION_NAME which corresponds to the information_schema.TABLES.TABLE_COLLATION value. Executable comment syntax is used to limited to the applicable versions. To preserve compatibility with older MariaDB versions, and MySQL versions where the previous COLLATION_NAME was the match is left as a JOIN criteria. In new MariaDB versions this won't result in an extra row match. Closes: #6361 The lack of this fix did case the CI test to fail with a MariaDB-11.0+ container: ``` 1) Doctrine\DBAL\Tests\Functional\Schema\MySQLSchemaManagerTest::testEnsureTableWithoutOptionsAreReflectedInMetadata Undefined array key "engine" /home/runner/work/dbal/dbal/src/Schema/Table.php:927 /home/runner/work/dbal/dbal/tests/Functional/Schema/MySQLSchemaManagerTest.php:550 ``` With this fix all version of MySQL and MariaDB (even those new ones soon to be in a different PR) will pass like: https://github.com/grooverdan/dbal/actions/runs/9412110648/job/25926481038 --- src/Schema/MySQLSchemaManager.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Schema/MySQLSchemaManager.php b/src/Schema/MySQLSchemaManager.php index 3c00d00e239..2305b77a71a 100644 --- a/src/Schema/MySQLSchemaManager.php +++ b/src/Schema/MySQLSchemaManager.php @@ -557,6 +557,11 @@ protected function selectForeignKeyColumns(string $databaseName, ?string $tableN */ protected function fetchTableOptionsByTable(string $databaseName, ?string $tableName = null): array { + // MariaDB-10.10.1 added FULL_COLLATION_NAME to the information_schema.COLLATION_CHARACTER_SET_APPLICABILITY. + // A base collation like uca1400_ai_ci can refer to multiple character sets. The value in the + // information_schema.TABLES.TABLE_COLLATION corresponds to the full collation name. + // The MariaDB executable comment syntax with version, /*M!101001, is exclusively executed on + // MariaDB-10.10.1+ servers for backwards compatibility, and compatiblity to MySQL servers. $sql = <<<'SQL' SELECT t.TABLE_NAME, t.ENGINE, @@ -567,7 +572,8 @@ protected function fetchTableOptionsByTable(string $databaseName, ?string $table ccsa.CHARACTER_SET_NAME FROM information_schema.TABLES t INNER JOIN information_schema.COLLATION_CHARACTER_SET_APPLICABILITY ccsa - ON ccsa.COLLATION_NAME = t.TABLE_COLLATION + ON /*M!101001 ccsa.FULL_COLLATION_NAME = t.TABLE_COLLATION OR */ + ccsa.COLLATION_NAME = t.TABLE_COLLATION SQL; $conditions = ['t.TABLE_SCHEMA = ?']; From 7f9b78d6e5b60e190276e51b9335120078c64e1b Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Fri, 7 Jun 2024 18:35:40 +0200 Subject: [PATCH 7/9] Fix typo in the portability documentation (#6430) --- docs/en/reference/portability.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/reference/portability.rst b/docs/en/reference/portability.rst index 3eaf8ae2267..b98bad718fa 100644 --- a/docs/en/reference/portability.rst +++ b/docs/en/reference/portability.rst @@ -53,7 +53,7 @@ Using the following code block in your initialization will: use Doctrine\DBAL\ColumnCase; use Doctrine\DBAL\Configuration; use Doctrine\DBAL\Portability\Connection as PortableConnection; - use Doctrine\DBAL\Portability\Middleware as PotableMiddleware; + use Doctrine\DBAL\Portability\Middleware as PortableMiddleware; $configuration = new Configuration(); $configuration->setMiddlewares([ From ac1b4fb6248f001ff261a4f08841122b6b6dc0d1 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sat, 8 Jun 2024 19:45:05 +0200 Subject: [PATCH 8/9] CI MariaDB: add 11.4, remove 11.0 (#6432) Cherry-picked from #6426. Co-authored-by: Daniel Black --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 57ca34a223e..d7a9741b865 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -302,10 +302,10 @@ jobs: - "10.5" # LTS (Jun 2025) - "10.6" # LTS (Jul 2026) - "10.11" # LTS (Feb 2028) - - "11.0" # STS (Jun 2024) - "11.1" # STS (Aug 2024) - "11.2" # STS (Nov 2024) - "11.3" # STS (Feb 2025) + - "11.4" # LTS (May 2029) extension: - "mysqli" - "pdo_mysql" From 0e3536ba088a749985c8801105b6b3ac6c1280b6 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sun, 9 Jun 2024 03:49:56 +1000 Subject: [PATCH 9/9] CI: Update MariaDB versions (#6426) | Q | A |------------- | ----------- | Type | improvement | Fixed issues | N/A #### Summary Improve the CI to cover newer versions of MariaDB 11.4+. Also cover the quay.io/mariadb-foundation/mariadb-devel images from https://quay.io/repository/mariadb-foundation/mariadb-devel?tab=tags where they are updated with completed, reviewed and tested changes in the MariaDB server main branch. These are completed features/bug fixes in the next server version. As such this is a good thing to test before the users get the final product. ref: https://mariadb.org/new-service-quay-io-mariadb-foundation-mariadb-devel/ The test failures here are fixed by #6425. --- .github/workflows/continuous-integration.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index d7a9741b865..fcb77758984 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -317,16 +317,16 @@ jobs: mariadb-version: "10.6" extension: "pdo_mysql" - php-version: "8.2" - mariadb-version: "11.2" + mariadb-version: "11.4" extension: "mysqli" - php-version: "8.2" - mariadb-version: "11.2" + mariadb-version: "11.4" extension: "pdo_mysql" - php-version: "8.3" - mariadb-version: "11.2" + mariadb-version: "11.4" extension: "mysqli" - php-version: "8.3" - mariadb-version: "11.2" + mariadb-version: "11.4" extension: "pdo_mysql" services: @@ -337,7 +337,7 @@ jobs: MYSQL_DATABASE: "doctrine_tests" options: >- - --health-cmd "mariadb-admin ping --silent || mysqladmin ping --silent" + --health-cmd "healthcheck.sh --connect --innodb_initialized || mysqladmin ping --protocol tcp --silent" ports: - "3306:3306"