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 <tomascohen@theke.io>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomás Cohen Arazi 2023-02-23 07:56:31 -03:00
parent 77b3e01ca0
commit 4a28d42959
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -1,12 +1,17 @@
use Modern::Perl; use Modern::Perl;
return { return {
bug_number => "31948", bug_number => "31948",
description => "Add timestamp to tmp_holdsqueue table", description => "Add timestamp to tmp_holdsqueue table",
up => sub { up => sub {
my ($args) = @_; my ($args) = @_;
my ($dbh, $out) = @$args{qw(dbh out)}; 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
});
}
}, },
}; };