From 9215e561cc724d5dbc0732cf64d296e8fc85b77c Mon Sep 17 00:00:00 2001 From: Oleg Chulkov Date: Tue, 28 May 2024 21:33:09 +0200 Subject: [PATCH 1/3] remove duplicate set NLS_DATE_FORMAT --- src/Driver/OCI8/Middleware/InitializeSession.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Driver/OCI8/Middleware/InitializeSession.php b/src/Driver/OCI8/Middleware/InitializeSession.php index 314a04a6500..3a356fb3177 100644 --- a/src/Driver/OCI8/Middleware/InitializeSession.php +++ b/src/Driver/OCI8/Middleware/InitializeSession.php @@ -26,7 +26,6 @@ public function connect( 'ALTER SESSION SET' . " NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'" . " NLS_TIME_FORMAT = 'HH24:MI:SS'" - . " NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'" . " NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'" . " NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS TZH:TZM'" . " NLS_NUMERIC_CHARACTERS = '.,'", From 0aa672aa69f0bccea3ed0b7854305130a222d00e Mon Sep 17 00:00:00 2001 From: Christoph Krapp Date: Tue, 28 May 2024 23:39:47 +0200 Subject: [PATCH 2/3] Fix fk name change detection in schema comparator As index renaming support was introduced a while back do the same for foreign key name changes. Signed-off-by: Christoph Krapp --- src/Schema/Comparator.php | 4 ++++ tests/Schema/AbstractComparatorTestCase.php | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Schema/Comparator.php b/src/Schema/Comparator.php index 28e7f2f73b2..804c981702b 100644 --- a/src/Schema/Comparator.php +++ b/src/Schema/Comparator.php @@ -555,6 +555,10 @@ private function detectRenamedIndexes(array &$addedIndexes, array &$removedIndex */ public function diffForeignKey(ForeignKeyConstraint $key1, ForeignKeyConstraint $key2) { + if (strtolower($key1->getName()) !== strtolower($key2->getName())) { + return true; + } + if ( array_map('strtolower', $key1->getUnquotedLocalColumns()) !== array_map('strtolower', $key2->getUnquotedLocalColumns()) diff --git a/tests/Schema/AbstractComparatorTestCase.php b/tests/Schema/AbstractComparatorTestCase.php index a087202628f..6c222f21cef 100644 --- a/tests/Schema/AbstractComparatorTestCase.php +++ b/tests/Schema/AbstractComparatorTestCase.php @@ -683,8 +683,9 @@ public function testCompareForeignKeyBasedOnPropertiesNotName(): void $tableB->addForeignKeyConstraint('bar', ['id'], ['id'], [], 'bar_constraint'); $tableDiff = $this->comparator->diffTable($tableA, $tableB); - - self::assertFalse($tableDiff); + self::assertNotFalse($tableDiff); + self::assertCount(1, $tableDiff->addedForeignKeys); + self::assertCount(1, $tableDiff->removedForeignKeys); } public function testCompareForeignKeyRestrictNoActionAreTheSame(): void From 422e459e4b12aad01ea86fa9ad87afeacddc4998 Mon Sep 17 00:00:00 2001 From: Christoph Krapp Date: Tue, 28 May 2024 23:47:20 +0200 Subject: [PATCH 3/3] Fix test names to reflect their actual purpose Both tests did expect a name change to result in an empty table diff in the past. When index renaming support was introduced the name of the test was not changed to reflect the new expectation. Signed-off-by: Christoph Krapp --- tests/Schema/AbstractComparatorTestCase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Schema/AbstractComparatorTestCase.php b/tests/Schema/AbstractComparatorTestCase.php index 6c222f21cef..0470c0cdfea 100644 --- a/tests/Schema/AbstractComparatorTestCase.php +++ b/tests/Schema/AbstractComparatorTestCase.php @@ -652,7 +652,7 @@ public function testCompareColumnCompareCaseInsensitive(): void self::assertFalse($tableDiff); } - public function testCompareIndexBasedOnPropertiesNotName(): void + public function testDetectIndexNameChange(): void { $tableA = new Table('foo'); $tableA->addColumn('id', Types::INTEGER); @@ -672,7 +672,7 @@ public function testCompareIndexBasedOnPropertiesNotName(): void ); } - public function testCompareForeignKeyBasedOnPropertiesNotName(): void + public function testDetectForeignKeyNameChange(): void { $tableA = new Table('foo'); $tableA->addColumn('id', Types::INTEGER);