Only mark migrations as installed after execution

The problem is that if a developer creates a structural error in their migration file,
they will already be marked as executed and an not be rerun.

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2021-03-04 08:49:42 +01:00
parent 9b573c6bd5
commit 1e5fea0460
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
1 changed files with 4 additions and 2 deletions

View File

@ -453,8 +453,6 @@ class MigrationService {
$toSchema = $instance->changeSchema($this->output, function () use ($toSchema) {
return $toSchema ?: new SchemaWrapper($this->connection);
}, ['tablePrefix' => $this->connection->getPrefix()]) ?: $toSchema;
$this->markAsExecuted($version);
}
if ($toSchema instanceof SchemaWrapper) {
@ -466,6 +464,10 @@ class MigrationService {
$this->connection->migrateToSchema($targetSchema);
$toSchema->performDropTableCalls();
}
foreach ($toBeExecuted as $version) {
$this->markAsExecuted($version);
}
}
/**