@@ -, +, @@ as all items that could fill that hold are now unavailable --- .../data/mysql/atomicupdate/bug_24860.perl | 21 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 4 ++++ 2 files changed, 25 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_24860.perl --- a/installer/data/mysql/atomicupdate/bug_24860.perl +++ a/installer/data/mysql/atomicupdate/bug_24860.perl @@ -0,0 +1,21 @@ +$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; + }); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 24860 - Add ability to place item group level holds)\n"; +} --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -4010,6 +4010,7 @@ CREATE TABLE `old_reserves` ( `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for', `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places', `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on', + `item_group_id` int(11) NULL default NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold', `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at', `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at', `notificationdate` date DEFAULT NULL COMMENT 'currently unused', @@ -4036,6 +4037,7 @@ CREATE TABLE `old_reserves` ( KEY `old_reserves_itemnumber` (`itemnumber`), KEY `old_reserves_branchcode` (`branchcode`), KEY `old_reserves_itemtype` (`itemtype`), + CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL, CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL, CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL, CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL, @@ -4456,6 +4458,7 @@ CREATE TABLE `reserves` ( `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for', `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed', `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on', + `item_group_id` int(11) NULL default NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold', `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at', `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at', `notificationdate` date DEFAULT NULL COMMENT 'currently unused', @@ -4484,6 +4487,7 @@ CREATE TABLE `reserves` ( KEY `branchcode` (`branchcode`), KEY `desk_id` (`desk_id`), KEY `itemtype` (`itemtype`), + CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, --