@@ -, +, @@ as all items that could fill that hold are now unavailable --- installer/data/mysql/atomicupdate/volumes.perl | 16 ++++++++++++++++ installer/data/mysql/kohastructure.sql | 7 ++++++- 2 files changed, 22 insertions(+), 1 deletion(-) --- a/installer/data/mysql/atomicupdate/volumes.perl +++ a/installer/data/mysql/atomicupdate/volumes.perl @@ -39,6 +39,22 @@ if ( CheckVersion( $DBversion ) ) { }); } + unless ( column_exists( 'reserves', 'volume_id' ) ) { + $dbh->do(q{ + ALTER TABLE reserves + ADD COLUMN `volume_id` int(11) NULL default NULL AFTER biblionumber, + ADD CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`volume_id`) REFERENCES `volumes` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; + }); + } + + unless ( column_exists( 'old_reserves', 'volume_id' ) ) { + $dbh->do(q{ + ALTER TABLE old_reserves + ADD COLUMN `volume_id` int(11) NULL default NULL AFTER biblionumber, + ADD CONSTRAINT `old_reserves_ibfk_5` FOREIGN KEY (`volume_id`) REFERENCES `volumes` (`id`) ON DELETE SET NULL ON UPDATE SET NULL; + }); + } + # Always end with this (adjust the bug info) SetVersion( $DBversion ); print "Upgrade to $DBversion done (Bug XXXXX - Add ability to define volumes for items on a record)\n"; --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -1779,6 +1779,7 @@ CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha `borrowernumber` int(11) NOT NULL default 0, -- foreign key from the borrowers table defining which patron this hold is for `reservedate` date default NULL, -- the date the hold was placed `biblionumber` int(11) NOT NULL default 0, -- foreign key from the biblio table defining which bib record this hold is on + `volume_id` int(11) NULL default NULL, -- foreign key from the volumes table defining if this is a volume level hold `branchcode` varchar(10) default NULL, -- foreign key from the branches table defining which branch the patron wishes to pick this hold up at `notificationdate` date default NULL, -- currently unused `reminderdate` date default NULL, -- currently unused @@ -1806,7 +1807,8 @@ CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha 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, CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`volume_id`) REFERENCES `volumes` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- @@ -1819,6 +1821,7 @@ CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have b `borrowernumber` int(11) default NULL, -- foreign key from the borrowers table defining which patron this hold is for `reservedate` date default NULL, -- the date the hold was places `biblionumber` int(11) default NULL, -- foreign key from the biblio table defining which bib record this hold is on + `volume_id` int(11) NULL default NULL, -- foreign key from the volumes table defining if this is a volume level hold `branchcode` varchar(10) default NULL, -- foreign key from the branches table defining which branch the patron wishes to pick this hold up at `notificationdate` date default NULL, -- currently unused `reminderdate` date default NULL, -- currently unused @@ -1848,6 +1851,8 @@ CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have b CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL, CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) + ON DELETE SET NULL ON UPDATE SET NULL, + CONSTRAINT `old_reserves_ibfk_5` FOREIGN KEY (`volume_id`) REFERENCES `volumes` (`id`) ON DELETE SET NULL ON UPDATE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; --