Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(migration): Check if column exits before adding it
Signed-off-by: Git'Fellow <[email protected]>
  • Loading branch information
solracsf authored Oct 1, 2024
commit ffa19a9827b93817a64c2b9d737f19b7dc8bc88a
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