Skip to content

Commit 171a84e

Browse files
committed
fixed lost fk data
1 parent ff1a5c3 commit 171a84e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Blueprint/BlueprintDiff.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ public function applyColumnIndexes(bool $reverse = false)
4242
}
4343

4444
foreach ($this->getAddedIndexes($reverse) as $index) {
45-
$blueprint->{$index->name}($index->columns, $index->index, $index->algorithm);
45+
$addedIndex = $blueprint->{$index->name}($index->columns, $index->index, $index->algorithm);
46+
if ($index->on) {
47+
$addedIndex->on($index->on);
48+
}
49+
50+
if ($index->references) {
51+
$addedIndex->references($index->references);
52+
}
4653
}
4754

4855
foreach ($this->getRenamedIndexes($reverse) as $from => $to) {
@@ -191,7 +198,7 @@ public function extractForeignKey(string $on, string $reference): Fluent
191198
if (
192199
IndexType::Foreign->value !== $index->name ||
193200
$index->on !== $on ||
194-
!in_array($reference, $index->references)
201+
!in_array($reference, $references)
195202
) {
196203
continue;
197204
}

0 commit comments

Comments
 (0)