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 3844-3849 CREATE TABLE `old_issues` ( Link Here
3844
/*!40101 SET character_set_client = @saved_cs_client */;
3844
/*!40101 SET character_set_client = @saved_cs_client */;
3845
3845
3846
--
3846
--
3847
-- Table structure for table `hold_groups`
3848
--
3849
DROP TABLE IF EXISTS `hold_groups`;
3850
/*!40101 SET @saved_cs_client     = @@character_set_client */;
3851
/*!40101 SET character_set_client = utf8 */;
3852
CREATE TABLE hold_groups (
3853
    hold_group_id int unsigned NOT NULL AUTO_INCREMENT,
3854
    PRIMARY KEY (hold_group_id)
3855
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3856
/*!40101 SET character_set_client = @saved_cs_client */;
3857
3858
--
3847
-- Table structure for table `old_reserves`
3859
-- Table structure for table `old_reserves`
3848
--
3860
--
3849
3861
Lines 3874-3879 CREATE TABLE `old_reserves` ( Link Here
3874
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
3886
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
3875
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
3887
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
3876
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
3888
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
3889
  `hold_group_id` int unsigned NULL DEFAULT NULL COMMENT 'The id of a group of titles reservations fulfilled when one title is picked',
3877
  PRIMARY KEY (`reserve_id`),
3890
  PRIMARY KEY (`reserve_id`),
3878
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
3891
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
3879
  KEY `old_reserves_biblionumber` (`biblionumber`),
3892
  KEY `old_reserves_biblionumber` (`biblionumber`),
Lines 3883-3889 CREATE TABLE `old_reserves` ( Link Here
3883
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3896
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3884
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3897
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3885
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3898
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3886
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL
3899
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
3900
  CONSTRAINT `old_reserves_ibfk_5` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
3887
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3901
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3888
/*!40101 SET character_set_client = @saved_cs_client */;
3902
/*!40101 SET character_set_client = @saved_cs_client */;
3889
3903
Lines 4313-4318 CREATE TABLE `reserves` ( Link Here
4313
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4327
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4314
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4328
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4315
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4329
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4330
  `hold_group_id` int unsigned NULL DEFAULT NULL COMMENT 'The id of a group of titles reservations fulfilled when one title is picked',
4316
  PRIMARY KEY (`reserve_id`),
4331
  PRIMARY KEY (`reserve_id`),
4317
  KEY `priorityfoundidx` (`priority`,`found`),
4332
  KEY `priorityfoundidx` (`priority`,`found`),
4318
  KEY `borrowernumber` (`borrowernumber`),
4333
  KEY `borrowernumber` (`borrowernumber`),
Lines 4327-4332 CREATE TABLE `reserves` ( Link Here
4327
  CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4342
  CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4328
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4343
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4329
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE
4344
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE
4345
  CONSTRAINT `reserves_ibfk_7` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE SET NULL ON UPDATE CASCADE
4330
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4346
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4331
/*!40101 SET character_set_client = @saved_cs_client */;
4347
/*!40101 SET character_set_client = @saved_cs_client */;
4332
4348
4333
- 

Return to bug 15516