From aa9673746ff6680892fe9bff6b1f0c8a1b44bf17 Mon Sep 17 00:00:00 2001 From: David Maicher Date: Mon, 17 Jun 2024 22:02:35 +0200 Subject: [PATCH] Revert "Merge pull request #6413 from achterin/bugfix/foreign_key_name_change_detection" This reverts commit 080aab5a9588f137ef3e1ad7e0d056a4517b4e16, reversing changes made to a5d2bafb2b009cca29837db45ac6febe6c963859. --- src/Schema/Comparator.php | 4 ---- tests/Schema/AbstractComparatorTestCase.php | 9 ++++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Schema/Comparator.php b/src/Schema/Comparator.php index 804c981702b..28e7f2f73b2 100644 --- a/src/Schema/Comparator.php +++ b/src/Schema/Comparator.php @@ -555,10 +555,6 @@ 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 0470c0cdfea..a087202628f 100644 --- a/tests/Schema/AbstractComparatorTestCase.php +++ b/tests/Schema/AbstractComparatorTestCase.php @@ -652,7 +652,7 @@ public function testCompareColumnCompareCaseInsensitive(): void self::assertFalse($tableDiff); } - public function testDetectIndexNameChange(): void + public function testCompareIndexBasedOnPropertiesNotName(): void { $tableA = new Table('foo'); $tableA->addColumn('id', Types::INTEGER); @@ -672,7 +672,7 @@ public function testDetectIndexNameChange(): void ); } - public function testDetectForeignKeyNameChange(): void + public function testCompareForeignKeyBasedOnPropertiesNotName(): void { $tableA = new Table('foo'); $tableA->addColumn('id', Types::INTEGER); @@ -683,9 +683,8 @@ public function testDetectForeignKeyNameChange(): void $tableB->addForeignKeyConstraint('bar', ['id'], ['id'], [], 'bar_constraint'); $tableDiff = $this->comparator->diffTable($tableA, $tableB); - self::assertNotFalse($tableDiff); - self::assertCount(1, $tableDiff->addedForeignKeys); - self::assertCount(1, $tableDiff->removedForeignKeys); + + self::assertFalse($tableDiff); } public function testCompareForeignKeyRestrictNoActionAreTheSame(): void