Skip to content

Commit

Permalink
Merge pull request #6419 from doctrine/4.0.x
Browse files Browse the repository at this point in the history
Merge 4.0.x up into 4.1.x
  • Loading branch information
greg0ire committed Jun 2, 2024
2 parents f293a9b + cbd0e9a commit eb80c04
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/Driver/OCI8/Middleware/InitializeSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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 = '.,'",
Expand Down
4 changes: 4 additions & 0 deletions src/Schema/Comparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ private function detectRenamedIndexes(array &$addedIndexes, array &$removedIndex

protected function diffForeignKey(ForeignKeyConstraint $key1, ForeignKeyConstraint $key2): bool
{
if (strtolower($key1->getName()) !== strtolower($key2->getName())) {
return true;
}

if (
array_map('strtolower', $key1->getUnquotedLocalColumns())
!== array_map('strtolower', $key2->getUnquotedLocalColumns())
Expand Down
15 changes: 10 additions & 5 deletions tests/Schema/AbstractComparatorTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public function testCompareColumnCompareCaseInsensitive(): void
self::assertTrue($tableDiff->isEmpty());
}

public function testCompareIndexBasedOnPropertiesNotName(): void
public function testDetectIndexNameChange(): void
{
$tableA = new Table('foo');
$tableA->addColumn('id', Types::INTEGER);
Expand All @@ -363,7 +363,7 @@ public function testCompareIndexBasedOnPropertiesNotName(): void
);
}

public function testCompareForeignKeyBasedOnPropertiesNotName(): void
public function testDetectForeignKeyNameChange(): void
{
$tableA = new Table('foo');
$tableA->addColumn('id', Types::INTEGER);
Expand All @@ -373,9 +373,14 @@ public function testCompareForeignKeyBasedOnPropertiesNotName(): void
$tableB->addColumn('ID', Types::INTEGER);
$tableB->addForeignKeyConstraint('bar', ['id'], ['id'], [], 'bar_constraint');

$tableDiff = $this->comparator->compareTables($tableA, $tableB);

self::assertTrue($tableDiff->isEmpty());
self::assertEquals(
new TableDiff($tableA, [], [], [], [], [], [], [], [], [
new ForeignKeyConstraint(['id'], 'bar', ['id'], 'bar_constraint'),
], [], [
new ForeignKeyConstraint(['id'], 'bar', ['id'], 'foo_constraint'),
]),
$this->comparator->compareTables($tableA, $tableB),
);
}

public function testDetectRenameColumn(): void
Expand Down

0 comments on commit eb80c04

Please sign in to comment.