Skip to content

Commit

Permalink
DEBUG Merge branch 'fix_unique_for_fk' into feature/join-foreign-id-f…
Browse files Browse the repository at this point in the history
…ield-not-id
  • Loading branch information
mvorisek committed Aug 20, 2023
2 parents d3933ca + a66d7f8 commit cf347c7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Schema/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,14 +492,13 @@ public function createForeignKey($relation): void

if (!$this->isIndexExists([$foreignField], true)) {
if ($foreignField->nullable && !$foreignField->required && $platform instanceof SQLServerPlatform) {
// workaround https://github.com/doctrine/dbal/issues/5507
$foreignFieldForIndex = clone $foreignField;
$foreignFieldForIndex->nullable = false;
} else {
$foreignFieldForIndex = $foreignField;
}

$this->createIndex([$foreignField], true);
$this->createIndex([$foreignFieldForIndex], true);
}

$foreignKey = new ForeignKeyConstraint(
Expand Down

0 comments on commit cf347c7

Please sign in to comment.