From f9400fbe2890d5e177f3e125a2a78f9d04ca1083 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 16 Jan 2025 10:44:39 +0100 Subject: [PATCH] Bug 35635: Adjust atomic update So that we don't do anything if the new column exists already. --- .../bug_35635_add_opac_mandatory.pl | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_35635_add_opac_mandatory.pl b/installer/data/mysql/atomicupdate/bug_35635_add_opac_mandatory.pl index d08c820d4f2..7d1058b4ed2 100755 --- a/installer/data/mysql/atomicupdate/bug_35635_add_opac_mandatory.pl +++ b/installer/data/mysql/atomicupdate/bug_35635_add_opac_mandatory.pl @@ -8,16 +8,16 @@ return { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; - $dbh->do( - q{ - ALTER TABLE borrower_attribute_types - MODIFY COLUMN `mandatory` tinyint(1) DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not in the staff interface' - } - ); + if ( !column_exists( 'borrower_attribute_types', 'opac_mandatory' ) ) { - say $out "Modified column 'borrower_attribute_types.mandatory'"; + $dbh->do( + q{ + ALTER TABLE borrower_attribute_types + MODIFY COLUMN `mandatory` tinyint(1) DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not in the staff interface' + } + ); + say $out "Modified column 'borrower_attribute_types.mandatory'"; - if ( !column_exists( 'borrower_attribute_types', 'opac_mandatory' ) ) { $dbh->do( q{ ALTER TABLE borrower_attribute_types @@ -25,7 +25,6 @@ return { AFTER `mandatory` } ); - say $out "Added column 'borrower_attribute_types.opac_mandatory'"; $dbh->do( -- 2.39.5