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 committed by backportbot[bot]
parent b2072cd6fc
commit e3927afe19
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);
}
}
/**