fix(migration): Check if column exits before adding it

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
pull/48480/head
Git'Fellow 2 months ago committed by GitHub
parent e2e5de8724
commit ffa19a9827
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 36
      core/Migrations/Version30000Date20240708160048.php

@ -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;
}

Loading…
Cancel
Save