Skip to content

Commit d05efa4

Browse files
author
Bizley
authored
Resetting applied changes before running Inspector (#99)
1 parent 972acab commit d05efa4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Inspector.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public function __construct(
4545
$this->comparator = $comparator;
4646
}
4747

48+
/** @var array<StructureChangeInterface> */
49+
private $appliedChanges = [];
50+
4851
/** @var string */
4952
private $currentTable;
5053

@@ -70,6 +73,7 @@ public function prepareBlueprint(
7073
?string $engineVersion
7174
): BlueprintInterface {
7275
$this->currentTable = $newStructure->getName();
76+
$this->appliedChanges = [];
7377
$history = $this->historyManager->fetchHistory();
7478

7579
$blueprint = new Blueprint();
@@ -89,7 +93,9 @@ public function prepareBlueprint(
8993
}
9094
}
9195

92-
if (count($this->appliedChanges)) {
96+
/** @var int $appliedChanges */
97+
$appliedChanges = count($this->appliedChanges);
98+
if ($appliedChanges) {
9399
$this->comparator->compare(
94100
$newStructure,
95101
$this->structureBuilder->build(array_reverse($this->appliedChanges), $schema, $engineVersion),
@@ -108,9 +114,6 @@ public function prepareBlueprint(
108114
return $blueprint;
109115
}
110116

111-
/** @var array<StructureChangeInterface> */
112-
private $appliedChanges = [];
113-
114117
/**
115118
* Gathers the changes from migrations recursively.
116119
* @param array<string, array<StructureChangeInterface>>|null $changes

0 commit comments

Comments
 (0)