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:
parent
b2072cd6fc
commit
e3927afe19
|
@ -453,8 +453,6 @@ class MigrationService {
|
||||||
$toSchema = $instance->changeSchema($this->output, function () use ($toSchema) {
|
$toSchema = $instance->changeSchema($this->output, function () use ($toSchema) {
|
||||||
return $toSchema ?: new SchemaWrapper($this->connection);
|
return $toSchema ?: new SchemaWrapper($this->connection);
|
||||||
}, ['tablePrefix' => $this->connection->getPrefix()]) ?: $toSchema;
|
}, ['tablePrefix' => $this->connection->getPrefix()]) ?: $toSchema;
|
||||||
|
|
||||||
$this->markAsExecuted($version);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($toSchema instanceof SchemaWrapper) {
|
if ($toSchema instanceof SchemaWrapper) {
|
||||||
|
@ -466,6 +464,10 @@ class MigrationService {
|
||||||
$this->connection->migrateToSchema($targetSchema);
|
$this->connection->migrateToSchema($targetSchema);
|
||||||
$toSchema->performDropTableCalls();
|
$toSchema->performDropTableCalls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($toBeExecuted as $version) {
|
||||||
|
$this->markAsExecuted($version);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue