Skip to content

Commit

Permalink
migration: add missing column checks (fix #845)
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed Oct 6, 2023
1 parent 14941a6 commit 12bd882
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
10 changes: 6 additions & 4 deletions lib/Migration/Version505000Date20230821044807.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
$schema = $schemaClosure();

$table = $schema->getTable('memories');
$table->addColumn('epoch', Types::BIGINT, [
'notnull' => true,
'default' => 0,
]);
if (!$table->hasColumn('epoch')) {
$table->addColumn('epoch', Types::BIGINT, [
'notnull' => true,
'default' => 0,
]);
}

return $schema;
}
Expand Down
12 changes: 7 additions & 5 deletions lib/Migration/Version505004Date20231004200012.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
$schema = $schemaClosure();

$table = $schema->getTable('memories');
$table->addColumn('buid', Types::STRING, [
'notnull' => false,
'length' => 32,
'default' => '',
]);
if (!$table->hasColumn('buid')) {
$table->addColumn('buid', Types::STRING, [
'notnull' => false,
'length' => 32,
'default' => '',
]);
}

return $schema;
}
Expand Down

0 comments on commit 12bd882

Please sign in to comment.