From 634cc603a11f9b12f5f019e7e34f6fc229b2476f 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 Content-Type: text/plain; charset=utf-8 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 --- 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.30.2