From 5dde4986161b812bd34fefb3879da5ed0d353c02 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Tue, 18 Aug 2026 10:20:19 +0200 Subject: [PATCH] fix: make OC\Core\Migrations\Version30000Date20240717111406 safer when adding columns in taskprocessing_tasks Signed-off-by: Julien Veyssier --- .../Version30000Date20240717111406.php | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/core/Migrations/Version30000Date20240717111406.php b/core/Migrations/Version30000Date20240717111406.php index 8f06c003b0e..b3cfc91639a 100644 --- a/core/Migrations/Version30000Date20240717111406.php +++ b/core/Migrations/Version30000Date20240717111406.php @@ -34,24 +34,29 @@ class Version30000Date20240717111406 extends SimpleMigrationStep { public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); + $schemaChanged = false; if ($schema->hasTable('taskprocessing_tasks')) { $table = $schema->getTable('taskprocessing_tasks'); - $table->addColumn('webhook_uri', Types::STRING, [ - 'notnull' => false, - 'default' => null, - 'length' => 4000, - ]); - $table->addColumn('webhook_method', Types::STRING, [ - 'notnull' => false, - 'default' => null, - 'length' => 64, - ]); - - return $schema; + if (!$table->hasColumn('webhook_uri')) { + $table->addColumn('webhook_uri', Types::STRING, [ + 'notnull' => false, + 'default' => null, + 'length' => 4000, + ]); + $schemaChanged = true; + } + if (!$table->hasColumn('webhook_method')) { + $table->addColumn('webhook_method', Types::STRING, [ + 'notnull' => false, + 'default' => null, + 'length' => 64, + ]); + $schemaChanged = true; + } } - return null; + return $schemaChanged ? $schema : null; } }