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 4101-4106 CREATE TABLE `old_reserves` ( Link Here
4101
  `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4101
  `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4102
  `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
4102
  `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
4103
  `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4103
  `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4104
  `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',
4104
  `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',
4105
  `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',
4105
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4106
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4106
  `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4107
  `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
Lines 4127-4132 CREATE TABLE `old_reserves` ( Link Here
4127
  KEY `old_reserves_itemnumber` (`itemnumber`),
4128
  KEY `old_reserves_itemnumber` (`itemnumber`),
4128
  KEY `old_reserves_branchcode` (`branchcode`),
4129
  KEY `old_reserves_branchcode` (`branchcode`),
4129
  KEY `old_reserves_itemtype` (`itemtype`),
4130
  KEY `old_reserves_itemtype` (`itemtype`),
4131
  CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL,
4130
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4132
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4131
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4133
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4132
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4134
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
Lines 4547-4552 CREATE TABLE `reserves` ( Link Here
4547
  `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4549
  `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4548
  `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
4550
  `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
4549
  `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4551
  `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4552
  `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',
4550
  `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',
4553
  `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',
4551
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4554
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4552
  `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4555
  `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
Lines 4575-4580 CREATE TABLE `reserves` ( Link Here
4575
  KEY `branchcode` (`branchcode`),
4578
  KEY `branchcode` (`branchcode`),
4576
  KEY `desk_id` (`desk_id`),
4579
  KEY `desk_id` (`desk_id`),
4577
  KEY `itemtype` (`itemtype`),
4580
  KEY `itemtype` (`itemtype`),
4581
  CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4578
  CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4582
  CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4579
  CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4583
  CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4580
  CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4584
  CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4581
- 

Return to bug 24860