Skip to content

Commit ddc13f9

Browse files
authored
Merge pull request #63404 from nextcloud/backport/63350/stable34
[stable34] Fix one core migration: Only add taskprocessing columns if they don't exist
2 parents e74c4d2 + 7476355 commit ddc13f9

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

core/Migrations/Version30000Date20240717111406.php

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,29 @@ class Version30000Date20240717111406 extends SimpleMigrationStep {
3333
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
3434
/** @var ISchemaWrapper $schema */
3535
$schema = $schemaClosure();
36+
$schemaChanged = false;
3637

3738
if ($schema->hasTable('taskprocessing_tasks')) {
3839
$table = $schema->getTable('taskprocessing_tasks');
3940

40-
$table->addColumn('webhook_uri', Types::STRING, [
41-
'notnull' => false,
42-
'default' => null,
43-
'length' => 4000,
44-
]);
45-
$table->addColumn('webhook_method', Types::STRING, [
46-
'notnull' => false,
47-
'default' => null,
48-
'length' => 64,
49-
]);
50-
51-
return $schema;
41+
if (!$table->hasColumn('webhook_uri')) {
42+
$table->addColumn('webhook_uri', Types::STRING, [
43+
'notnull' => false,
44+
'default' => null,
45+
'length' => 4000,
46+
]);
47+
$schemaChanged = true;
48+
}
49+
if (!$table->hasColumn('webhook_method')) {
50+
$table->addColumn('webhook_method', Types::STRING, [
51+
'notnull' => false,
52+
'default' => null,
53+
'length' => 64,
54+
]);
55+
$schemaChanged = true;
56+
}
5257
}
5358

54-
return null;
59+
return $schemaChanged ? $schema : null;
5560
}
5661
}

0 commit comments

Comments
 (0)