]> source.dussan.org Git - nextcloud-server.git/commitdiff
Only mark migrations as installed after execution 26379/head
authorJoas Schilling <coding@schilljs.com>
Thu, 4 Mar 2021 07:49:42 +0000 (08:49 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Tue, 30 Mar 2021 19:51:12 +0000 (19:51 +0000)
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>
lib/private/DB/MigrationService.php

index 447079110924f19ec7e4f1a1f13ace525479058c..42c3de3ea1eeae033d58b5e571eac52d805c373d 100644 (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);
+               }
        }
 
        /**