View | Details | Raw Unified | Return to bug 24860
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_24860.perl (+21 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if ( CheckVersion( $DBversion ) ) {
3
    unless ( column_exists( 'reserves', 'item_group_id' ) ) {
4
        $dbh->do(q{
5
            ALTER TABLE reserves
6
            ADD COLUMN `item_group_id` int(11) NULL default NULL AFTER biblionumber,
7
            ADD CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE;
8
        });
9
    }
10
11
    unless ( column_exists( 'old_reserves', 'item_group_id' ) ) {
12
        $dbh->do(q{
13
            ALTER TABLE old_reserves
14
            ADD COLUMN `item_group_id` int(11) NULL default NULL AFTER biblionumber,
15
            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;
16
        });
17
    }
18
19
    SetVersion( $DBversion );
20
    print "Upgrade to $DBversion done (Bug 24860 - Add ability to place item group level holds)\n";
21
}
(-)a/installer/data/mysql/kohastructure.sql (-1 / +4 lines)
Lines 4010-4015 CREATE TABLE `old_reserves` ( Link Here
4010
  `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4010
  `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4011
  `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
4011
  `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
4012
  `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4012
  `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4013
  `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',
4013
  `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',
4014
  `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',
4014
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4015
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4015
  `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4016
  `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
Lines 4036-4041 CREATE TABLE `old_reserves` ( Link Here
4036
  KEY `old_reserves_itemnumber` (`itemnumber`),
4037
  KEY `old_reserves_itemnumber` (`itemnumber`),
4037
  KEY `old_reserves_branchcode` (`branchcode`),
4038
  KEY `old_reserves_branchcode` (`branchcode`),
4038
  KEY `old_reserves_itemtype` (`itemtype`),
4039
  KEY `old_reserves_itemtype` (`itemtype`),
4040
  CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL,
4039
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4041
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4040
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4042
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4041
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4043
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
Lines 4456-4461 CREATE TABLE `reserves` ( Link Here
4456
  `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4458
  `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4457
  `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
4459
  `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
4458
  `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4460
  `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4461
  `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',
4459
  `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',
4462
  `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',
4460
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4463
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4461
  `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4464
  `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
Lines 4484-4489 CREATE TABLE `reserves` ( Link Here
4484
  KEY `branchcode` (`branchcode`),
4487
  KEY `branchcode` (`branchcode`),
4485
  KEY `desk_id` (`desk_id`),
4488
  KEY `desk_id` (`desk_id`),
4486
  KEY `itemtype` (`itemtype`),
4489
  KEY `itemtype` (`itemtype`),
4490
  CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4487
  CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4491
  CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4488
  CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4492
  CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4489
  CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4493
  CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4490
- 

Return to bug 24860