From db4baee498f3eab9d44efd00dd82b45e32ed8b29 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Sat, 2 Apr 2022 12:58:25 +0200 Subject: [PATCH] Bug 27783: (QA follow-up) Make dbrev idempotent Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize Signed-off-by: Fridolin Somers --- .../data/mysql/atomicupdate/bug-27783.pl | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug-27783.pl b/installer/data/mysql/atomicupdate/bug-27783.pl index 7fee204990..1f17eb6ea5 100644 --- a/installer/data/mysql/atomicupdate/bug-27783.pl +++ b/installer/data/mysql/atomicupdate/bug-27783.pl @@ -7,14 +7,19 @@ return { my ($args) = @_; my ($dbh, $out) = @$args{qw(dbh out)}; - $dbh->do(q{ - ALTER TABLE `background_jobs` - ADD `queue` VARCHAR(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'Name of the queue the job is sent to' AFTER `type` - }); - $dbh->do(q{ - ALTER TABLE `background_jobs` - ADD KEY `queue` (`queue`) - }); + unless ( column_exists( 'background_jobs', 'queue' ) ) { + $dbh->do(q{ + ALTER TABLE `background_jobs` + ADD COLUMN `queue` VARCHAR(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'Name of the queue the job is sent to' AFTER `type` + }); + } + + unless ( index_exists( 'background_jobs', 'queue' ) ) { + $dbh->do(q{ + ALTER TABLE `background_jobs` + ADD KEY `queue` (`queue`) + }); + } say $out "Added background_jobs.queue"; }, -- 2.39.5