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

(-)a/installer/data/mysql/atomicupdate/bug_15516_-_hold_group_table.perl (+22 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
4
    unless( TableExists( 'hold_groups' ) ) {
5
        $dbh->do(q{CREATE TABLE hold_groups (
6
            hold_group_id int unsigned NOT NULL AUTO_INCREMENT,
7
            PRIMARY KEY (hold_group_id)
8
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci});
9
    }
10
11
    unless( column_exists( 'reserves', 'hold_group_id' ) ) {
12
        $dbh->do(q{ALTER TABLE reserves ADD COLUMN hold_group_id int unsigned NULL DEFAULT NULL AFTER non_priority});
13
        $dbh->do(q{ALTER TABLE reserves ADD CONSTRAINT reserves_ibfk_7 FOREIGN KEY (hold_group_id) REFERENCES hold_groups (hold_group_id) ON DELETE SET NULL ON UPDATE CASCADE});
14
    }
15
16
    unless( column_exists( 'old_reserves', 'hold_group_id') ) {
17
        $dbh->do(q{ALTER TABLE old_reserves ADD COLUMN hold_group_id int unsigned NULL DEFAULT NULL AFTER non_priority});
18
        $dbh->do(q{ALTER TABLE old_reserves ADD CONSTRAINT old_reserves_ibfk_5 FOREIGN KEY (hold_group_id) REFERENCES hold_groups (hold_group_id) ON DELETE SET NULL ON UPDATE CASCADE});
19
    }
20
21
    NewVersion( $DBversion, 15516, "Adding hold_groups table");
22
}
(-)a/installer/data/mysql/kohastructure.sql (-2 / +17 lines)
Lines 3904-3909 CREATE TABLE `old_issues` ( Link Here
3904
/*!40101 SET character_set_client = @saved_cs_client */;
3904
/*!40101 SET character_set_client = @saved_cs_client */;
3905
3905
3906
--
3906
--
3907
-- Table structure for table `hold_groups`
3908
--
3909
DROP TABLE IF EXISTS `hold_groups`;
3910
/*!40101 SET @saved_cs_client     = @@character_set_client */;
3911
/*!40101 SET character_set_client = utf8 */;
3912
CREATE TABLE hold_groups (
3913
    hold_group_id int unsigned NOT NULL AUTO_INCREMENT,
3914
    PRIMARY KEY (hold_group_id)
3915
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3916
/*!40101 SET character_set_client = @saved_cs_client */;
3917
3918
--
3907
-- Table structure for table `old_reserves`
3919
-- Table structure for table `old_reserves`
3908
--
3920
--
3909
3921
Lines 3934-3939 CREATE TABLE `old_reserves` ( Link Here
3934
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
3946
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
3935
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
3947
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
3936
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
3948
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
3949
  `hold_group_id` int unsigned NULL DEFAULT NULL COMMENT 'The id of a group of titles reservations fulfilled when one title is picked',
3937
  PRIMARY KEY (`reserve_id`),
3950
  PRIMARY KEY (`reserve_id`),
3938
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
3951
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
3939
  KEY `old_reserves_biblionumber` (`biblionumber`),
3952
  KEY `old_reserves_biblionumber` (`biblionumber`),
Lines 3943-3949 CREATE TABLE `old_reserves` ( Link Here
3943
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3956
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3944
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3957
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3945
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3958
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3946
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL
3959
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
3960
  CONSTRAINT `old_reserves_ibfk_5` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
3947
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3961
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3948
/*!40101 SET character_set_client = @saved_cs_client */;
3962
/*!40101 SET character_set_client = @saved_cs_client */;
3949
3963
Lines 4344-4349 CREATE TABLE `reserves` ( Link Here
4344
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4358
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4345
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4359
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4346
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4360
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4361
  `hold_group_id` int unsigned NULL DEFAULT NULL COMMENT 'The id of a group of titles reservations fulfilled when one title is picked',
4347
  PRIMARY KEY (`reserve_id`),
4362
  PRIMARY KEY (`reserve_id`),
4348
  KEY `priorityfoundidx` (`priority`,`found`),
4363
  KEY `priorityfoundidx` (`priority`,`found`),
4349
  KEY `borrowernumber` (`borrowernumber`),
4364
  KEY `borrowernumber` (`borrowernumber`),
Lines 4358-4363 CREATE TABLE `reserves` ( Link Here
4358
  CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4373
  CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4359
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4374
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4360
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE
4375
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE
4376
  CONSTRAINT `reserves_ibfk_7` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE SET NULL ON UPDATE CASCADE
4361
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4377
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4362
/*!40101 SET character_set_client = @saved_cs_client */;
4378
/*!40101 SET character_set_client = @saved_cs_client */;
4363
4379
4364
- 

Return to bug 15516