From 1e5fea0460a3e7de78b141acaec49a4cb750c4d7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 4 Mar 2021 08:49:42 +0100 Subject: [PATCH] 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 --- lib/private/DB/MigrationService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index 8bbd077d85dea..42f3b7de6a83e 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -453,8 +453,6 @@ public function migrateSchemaOnly($to = 'latest') { $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 @@ public function migrateSchemaOnly($to = 'latest') { $this->connection->migrateToSchema($targetSchema); $toSchema->performDropTableCalls(); } + + foreach ($toBeExecuted as $version) { + $this->markAsExecuted($version); + } } /**