From 9f845d83f9a2cf7da40c50ba2620454e0fd0059b Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 4 Oct 2023 13:59:26 -0400 Subject: [PATCH] Bug 9525: Atomic update fixes This patch modernizes the atomic update, makes it follow the current pattern of checking the column existence, and printing a message about the column being created. It also adds the COMMENT statement so tests pass later. Signed-off-by: Tomas Cohen Arazi --- ...-9525-Add_ft_local_float_group_column.perl | 10 --------- installer/data/mysql/atomicupdate/bug_9525.pl | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 10 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/Bug-9525-Add_ft_local_float_group_column.perl create mode 100755 installer/data/mysql/atomicupdate/bug_9525.pl diff --git a/installer/data/mysql/atomicupdate/Bug-9525-Add_ft_local_float_group_column.perl b/installer/data/mysql/atomicupdate/Bug-9525-Add_ft_local_float_group_column.perl deleted file mode 100644 index a6b549ec7e..0000000000 --- a/installer/data/mysql/atomicupdate/Bug-9525-Add_ft_local_float_group_column.perl +++ /dev/null @@ -1,10 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - # you can use $dbh here like: - # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" ); - - $dbh->do("ALTER TABLE library_groups ADD COLUMN IF NOT EXISTS ft_local_float_group tinyint(1) NOT NULL DEFAULT 0 AFTER ft_local_hold_group"); - - # Always end with this (adjust the bug info) - NewVersion( $DBversion, 9525, "Add option to set group as local float group"); -} diff --git a/installer/data/mysql/atomicupdate/bug_9525.pl b/installer/data/mysql/atomicupdate/bug_9525.pl new file mode 100755 index 0000000000..f3430bb217 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_9525.pl @@ -0,0 +1,22 @@ +use Modern::Perl; + +return { + bug_number => "9525", + description => "Add option to set group as local float group", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + unless ( column_exists( 'library_groups', 'ft_local_float_group' ) ) { + $dbh->do( + q{ + ALTER TABLE library_groups + ADD COLUMN `ft_local_float_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group to identify libraries as part of float group' + AFTER ft_local_hold_group + } + ); + + say $out "Added column 'library_groups.ft_local_float_group'"; + } + }, +}; -- 2.39.5