From dfa15b25a9cba7daf5460bcdc0f374d9ac331332 Mon Sep 17 00:00:00 2001 From: William Lavoie Date: Fri, 24 Jan 2025 10:22:08 -0500 Subject: [PATCH] Bug 35145: (follow-up) Corrected pattern for adding a column Corrected the pattern to add a column in the update file. --- .../bug_35145_order_patron_attributes.pl | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_35145_order_patron_attributes.pl b/installer/data/mysql/atomicupdate/bug_35145_order_patron_attributes.pl index 8dc108ffa1..091cd4ab0c 100755 --- a/installer/data/mysql/atomicupdate/bug_35145_order_patron_attributes.pl +++ b/installer/data/mysql/atomicupdate/bug_35145_order_patron_attributes.pl @@ -7,17 +7,14 @@ return { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; - # Do you stuffs here - $dbh->do( - q{ - ALTER TABLE borrower_attribute_types - ADD COLUMN IF NOT EXISTS display_order INT(11) DEFAULT NULL COMMENT - 'the order in which this attribute type appears in patron form' AFTER `mandatory` + # Do your stuff here + unless ( column_exists('borrower_attribute_types', 'display_order') ) { + $dbh->do(q{ + ALTER TABLE borrower_attribute_types + ADD COLUMN display_order INT(11) DEFAULT NULL COMMENT + 'the order in which this attribute type appears in patron form' AFTER `mandatory` + }); + say_success( $out, "Added column 'borrower_attribute_types.display_order'" ); } - ); - - # Print useful stuff here - # tables - say_success( $out, "Added column 'borrower_attribute_types.display_order'" ); }, -}; +}; -- 2.43.0