Skip to content

Commit

Permalink
Merge pull request #48489 from nextcloud/backport/48480/stable30
Browse files Browse the repository at this point in the history
[stable30] fix(migration): Check if column exits before adding it
  • Loading branch information
joshtrichards authored Oct 2, 2024
2 parents 080f7a7 + 45fd3d2 commit fcf45b6
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions core/Migrations/Version30000Date20240708160048.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,27 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
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;
}
Expand Down

0 comments on commit fcf45b6

Please sign in to comment.