From e7056634a507e35065a16d63e89f77eca6c9d7e7 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 23 Feb 2023 07:56:31 -0300 Subject: [PATCH] Bug 33051: Make 22600075.pl idempotent As there is no check, this dbrev could cause trouble if run twice. It doesn't look like it is going to get backported to 22.05, but just in case... Signed-off-by: Tomas Cohen Arazi Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 4a28d4295956e077c833b1bc91a12fb4a1c26ad7) Signed-off-by: Martin Renvoize --- installer/data/mysql/db_revs/220600075.pl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/db_revs/220600075.pl b/installer/data/mysql/db_revs/220600075.pl index df2dbb255c..279284a8dd 100755 --- a/installer/data/mysql/db_revs/220600075.pl +++ b/installer/data/mysql/db_revs/220600075.pl @@ -1,12 +1,17 @@ use Modern::Perl; return { - bug_number => "31948", + bug_number => "31948", description => "Add timestamp to tmp_holdsqueue table", up => sub { my ($args) = @_; my ($dbh, $out) = @$args{qw(dbh out)}; - $dbh->do(q{ALTER TABLE `tmp_holdsqueue` ADD `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP AFTER item_level_request}); + unless ( column_exists( 'tmp_holdsqueue', 'timestamp' ) ) { + $dbh->do(q{ + ALTER TABLE `tmp_holdsqueue` + ADD `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP AFTER item_level_request + }); + } }, }; -- 2.39.5