From 6c949b611dfbf3465340c35815f598ac5f56178a Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Wed, 19 Aug 2020 16:11:01 -0300 Subject: [PATCH] Bug 22789: Add non_priority column to reserves and old_reserves --- installer/data/mysql/atomicupdate/bug_22789.perl | 14 ++++++++++++++ installer/data/mysql/kohastructure.sql | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_22789.perl diff --git a/installer/data/mysql/atomicupdate/bug_22789.perl b/installer/data/mysql/atomicupdate/bug_22789.perl new file mode 100644 index 0000000000..1986b14ba6 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_22789.perl @@ -0,0 +1,14 @@ +$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" ); + + # or perform some test and warn + if( !column_exists( 'reserves', 'non_priority' ) ) { + $dbh->do("ALTER TABLE reserves ADD COLUMN `non_priority` tinyint(1) NOT NULL DEFAULT 0 AFTER `item_level_hold` -- Is this a non priority hold"); + $dbh->do("ALTER TABLE old_reserves ADD COLUMN `non_priority` tinyint(1) NOT NULL DEFAULT 0 AFTER `item_level_hold` -- Is this a non priority hold"); + } + + # Always end with this (adjust the bug info) + NewVersion( $DBversion, 22789, "Add non_priority column on reserves and old_reserves tables"); +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 35c643fa38..a09eb74d6a 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1772,6 +1772,7 @@ CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha `suspend_until` DATETIME NULL DEFAULT NULL, `itemtype` VARCHAR(10) NULL DEFAULT NULL, -- If record level hold, the optional itemtype of the item the patron is requesting `item_level_hold` tinyint(1) NOT NULL DEFAULT 0, -- Is the hpld placed at item level + `non_priority` tinyint(1) NOT NULL DEFAULT 0, -- Is this a non priority hold PRIMARY KEY (`reserve_id`), KEY priorityfoundidx (priority,found), KEY `borrowernumber` (`borrowernumber`), @@ -1812,6 +1813,7 @@ CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have b `suspend_until` DATETIME NULL DEFAULT NULL, -- the date this hold is suspended until (NULL for infinitely) `itemtype` VARCHAR(10) NULL DEFAULT NULL, -- If record level hold, the optional itemtype of the item the patron is requesting `item_level_hold` tinyint(1) NOT NULL DEFAULT 0, -- Is the hpld placed at item level + `non_priority` tinyint(1) NOT NULL DEFAULT 0, -- Is this a non priority hold PRIMARY KEY (`reserve_id`), KEY `old_reserves_borrowernumber` (`borrowernumber`), KEY `old_reserves_biblionumber` (`biblionumber`), -- 2.25.0