From 12bd8823e713b567257ad6bdb21f8afcfd1492d8 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Fri, 6 Oct 2023 15:14:16 -0700 Subject: [PATCH] migration: add missing column checks (fix #845) Signed-off-by: Varun Patil --- lib/Migration/Version505000Date20230821044807.php | 10 ++++++---- lib/Migration/Version505004Date20231004200012.php | 12 +++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/Migration/Version505000Date20230821044807.php b/lib/Migration/Version505000Date20230821044807.php index 499e9f67e..4d3ea6953 100644 --- a/lib/Migration/Version505000Date20230821044807.php +++ b/lib/Migration/Version505000Date20230821044807.php @@ -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; } diff --git a/lib/Migration/Version505004Date20231004200012.php b/lib/Migration/Version505004Date20231004200012.php index cc40d5eb0..030c19fa3 100644 --- a/lib/Migration/Version505004Date20231004200012.php +++ b/lib/Migration/Version505004Date20231004200012.php @@ -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; }