]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(migration): Check if column exits before adding it checkColExists 48480/head
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>
Tue, 1 Oct 2024 06:12:11 +0000 (08:12 +0200)
committerGitHub <noreply@github.com>
Tue, 1 Oct 2024 06:12:11 +0000 (08:12 +0200)
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
core/Migrations/Version30000Date20240708160048.php

index 253b9cc7a644cf0e7f76f51f46d224ae730f4160..83edd84e56a23b6e19be59c21103eb25a5435dad 100644 (file)
@@ -37,21 +37,27 @@ class Version30000Date20240708160048 extends SimpleMigrationStep {
                if ($schema->hasTable('taskprocessing_tasks')) {
                        $table = $schema->getTable('taskprocessing_tasks');
 
-                       $table->addColumn('scheduled_at', Types::INTEGER, [
-                               'notnull' => false,
-                               'default' => null,
-                               'unsigned' => true,
-                       ]);
-                       $table->addColumn('started_at', Types::INTEGER, [
-                               'notnull' => false,
-                               'default' => null,
-                               'unsigned' => true,
-                       ]);
-                       $table->addColumn('ended_at', Types::INTEGER, [
-                               'notnull' => false,
-                               'default' => null,
-                               'unsigned' => true,
-                       ]);
+                       if (!$table->hasColumn('scheduled_at')) {
+                               $table->addColumn('scheduled_at', Types::INTEGER, [
+                                       'notnull' => false,
+                                       'default' => null,
+                                       'unsigned' => true,
+                               ]);
+                       }
+                       if (!$table->hasColumn('started_at')) {
+                               $table->addColumn('started_at', Types::INTEGER, [
+                                       'notnull' => false,
+                                       'default' => null,
+                                       'unsigned' => true,
+                               ]);
+                       }
+                       if (!$table->hasColumn('ended_at')) {
+                               $table->addColumn('ended_at', Types::INTEGER, [
+                                       'notnull' => false,
+                                       'default' => null,
+                                       'unsigned' => true,
+                               ]);
+                       }
 
                        return $schema;
                }