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 3852-3857 CREATE TABLE `old_issues` ( Link Here
3852
/*!40101 SET character_set_client = @saved_cs_client */;
3852
/*!40101 SET character_set_client = @saved_cs_client */;
3853
3853
3854
--
3854
--
3855
-- Table structure for table `hold_groups`
3856
--
3857
DROP TABLE IF EXISTS `hold_groups`;
3858
/*!40101 SET @saved_cs_client     = @@character_set_client */;
3859
/*!40101 SET character_set_client = utf8 */;
3860
CREATE TABLE hold_groups (
3861
    hold_group_id int unsigned NOT NULL AUTO_INCREMENT,
3862
    PRIMARY KEY (hold_group_id)
3863
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3864
/*!40101 SET character_set_client = @saved_cs_client */;
3865
3866
--
3855
-- Table structure for table `old_reserves`
3867
-- Table structure for table `old_reserves`
3856
--
3868
--
3857
3869
Lines 3882-3887 CREATE TABLE `old_reserves` ( Link Here
3882
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
3894
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
3883
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
3895
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
3884
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
3896
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
3897
  `hold_group_id` int unsigned NULL DEFAULT NULL COMMENT 'The id of a group of titles reservations fulfilled when one title is picked',
3885
  PRIMARY KEY (`reserve_id`),
3898
  PRIMARY KEY (`reserve_id`),
3886
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
3899
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
3887
  KEY `old_reserves_biblionumber` (`biblionumber`),
3900
  KEY `old_reserves_biblionumber` (`biblionumber`),
Lines 3891-3897 CREATE TABLE `old_reserves` ( Link Here
3891
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3904
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3892
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3905
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3893
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3906
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3894
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL
3907
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
3908
  CONSTRAINT `old_reserves_ibfk_5` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
3895
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3909
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3896
/*!40101 SET character_set_client = @saved_cs_client */;
3910
/*!40101 SET character_set_client = @saved_cs_client */;
3897
3911
Lines 4321-4326 CREATE TABLE `reserves` ( Link Here
4321
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4335
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4322
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4336
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4323
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4337
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4338
  `hold_group_id` int unsigned NULL DEFAULT NULL COMMENT 'The id of a group of titles reservations fulfilled when one title is picked',
4324
  PRIMARY KEY (`reserve_id`),
4339
  PRIMARY KEY (`reserve_id`),
4325
  KEY `priorityfoundidx` (`priority`,`found`),
4340
  KEY `priorityfoundidx` (`priority`,`found`),
4326
  KEY `borrowernumber` (`borrowernumber`),
4341
  KEY `borrowernumber` (`borrowernumber`),
Lines 4335-4340 CREATE TABLE `reserves` ( Link Here
4335
  CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4350
  CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4336
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4351
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4337
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE
4352
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE
4353
  CONSTRAINT `reserves_ibfk_7` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE SET NULL ON UPDATE CASCADE
4338
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4354
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4339
/*!40101 SET character_set_client = @saved_cs_client */;
4355
/*!40101 SET character_set_client = @saved_cs_client */;
4340
4356
4341
- 

Return to bug 15516