From 1d8d1cd0dea5cc0915e570b4f8436fadfba4af3c Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 10 Mar 2026 14:07:41 +0000 Subject: [PATCH] Bug 23260: (follow-up) Add index check --- installer/data/mysql/db_revs/251200028.pl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/installer/data/mysql/db_revs/251200028.pl b/installer/data/mysql/db_revs/251200028.pl index f50af490152..35303be3cf8 100755 --- a/installer/data/mysql/db_revs/251200028.pl +++ b/installer/data/mysql/db_revs/251200028.pl @@ -8,16 +8,16 @@ return { up => sub { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; - - $dbh->do( - q{ - ALTER TABLE items_last_borrower - MODIFY COLUMN borrowernumber int(11) NULL, - MODIFY created_on timestamp NOT NULL DEFAULT current_timestamp() + unless ( index_exists( 'items_last_borrower', 'items_last_borrower_ibfk_1' ) ) { + $dbh->do( + q{ + ALTER TABLE items_last_borrower + MODIFY COLUMN borrowernumber int(11) NULL, + MODIFY created_on timestamp NOT NULL DEFAULT current_timestamp() + } + ); + say_success( $out, "Fixed items_last_borrower.created_on column to prevent automatic timestamp updates" ); } - ); - say_success( $out, "Fixed items_last_borrower.created_on column to prevent automatic timestamp updates" ); - $dbh->do( q{ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES -- 2.39.5