From d7d2b86136bd073c583c3b3d092992dd1d2d2e13 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 4 Nov 2022 19:52:11 -0300 Subject: [PATCH] Bug 24860: DBRev 22.06.00.078 Signed-off-by: Tomas Cohen Arazi --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_24860.perl | 26 --------------- installer/data/mysql/db_revs/220600078.pl | 33 +++++++++++++++++++ 3 files changed, 34 insertions(+), 27 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_24860.perl create mode 100755 installer/data/mysql/db_revs/220600078.pl diff --git a/Koha.pm b/Koha.pm index 21f9e8c070..df7f82ac18 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "22.06.00.077"; +$VERSION = "22.06.00.078"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_24860.perl b/installer/data/mysql/atomicupdate/bug_24860.perl deleted file mode 100644 index 861dc759d8..0000000000 --- a/installer/data/mysql/atomicupdate/bug_24860.perl +++ /dev/null @@ -1,26 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if ( CheckVersion( $DBversion ) ) { - unless ( column_exists( 'reserves', 'item_group_id' ) ) { - $dbh->do(q{ - ALTER TABLE reserves - ADD COLUMN `item_group_id` int(11) NULL default NULL AFTER biblionumber, - ADD CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE; - }); - } - - unless ( column_exists( 'old_reserves', 'item_group_id' ) ) { - $dbh->do(q{ - ALTER TABLE old_reserves - ADD COLUMN `item_group_id` int(11) NULL default NULL AFTER biblionumber, - ADD CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL; - }); - } - - $dbh->do(q{ - INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES - ('EnableItemGroupHolds','0','','Enable item group holds feature','YesNo') - }); - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 24860 - Add ability to place item group level holds)\n"; -} diff --git a/installer/data/mysql/db_revs/220600078.pl b/installer/data/mysql/db_revs/220600078.pl new file mode 100755 index 0000000000..947d221d0e --- /dev/null +++ b/installer/data/mysql/db_revs/220600078.pl @@ -0,0 +1,33 @@ +use Modern::Perl; + +return { + bug_number => "24860", + description => "Add ability to place item group level holds", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + unless ( column_exists( 'reserves', 'item_group_id' ) ) { + $dbh->do(q{ + ALTER TABLE reserves + ADD COLUMN `item_group_id` int(11) NULL default NULL AFTER biblionumber, + ADD CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE; + }); + } + + unless ( column_exists( 'old_reserves', 'item_group_id' ) ) { + $dbh->do(q{ + ALTER TABLE old_reserves + ADD COLUMN `item_group_id` int(11) NULL default NULL AFTER biblionumber, + ADD CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL; + }); + } + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('EnableItemGroupHolds','0','','Enable item group holds feature','YesNo') + }); + + say $out "Added new system preference 'EnableItemGroupHolds'"; + }, +}; -- 2.39.5