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

(-)a/installer/data/mysql/atomicupdate/bug_15516_-_hold_group_table.pl (+35 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "15516",
5
    description => "Add new table hold_groups",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        unless ( TableExists('hold_groups') ) {
11
            $dbh->do(
12
                q{CREATE TABLE hold_groups (
13
                hold_group_id int unsigned NOT NULL AUTO_INCREMENT,
14
                PRIMARY KEY (hold_group_id)
15
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci}
16
            );
17
        }
18
19
        unless ( column_exists( 'reserves', 'hold_group_id' ) ) {
20
            $dbh->do(
21
                q{ALTER TABLE reserves ADD COLUMN hold_group_id int unsigned NULL DEFAULT NULL AFTER non_priority});
22
            $dbh->do(
23
                q{ALTER TABLE reserves ADD CONSTRAINT reserves_ibfk_hg FOREIGN KEY (hold_group_id) REFERENCES hold_groups (hold_group_id) ON DELETE SET NULL ON UPDATE CASCADE}
24
            );
25
        }
26
27
        unless ( column_exists( 'old_reserves', 'hold_group_id' ) ) {
28
            $dbh->do(
29
                q{ALTER TABLE old_reserves ADD COLUMN hold_group_id int unsigned NULL DEFAULT NULL AFTER non_priority});
30
            $dbh->do(
31
                q{ALTER TABLE old_reserves ADD CONSTRAINT old_reserves_ibfk_hg FOREIGN KEY (hold_group_id) REFERENCES hold_groups (hold_group_id) ON DELETE SET NULL ON UPDATE CASCADE}
32
            );
33
        }
34
    },
35
};
(-)a/installer/data/mysql/kohastructure.sql (-3 / +18 lines)
Lines 5059-5064 CREATE TABLE `old_issues` ( Link Here
5059
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5059
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5060
/*!40101 SET character_set_client = @saved_cs_client */;
5060
/*!40101 SET character_set_client = @saved_cs_client */;
5061
5061
5062
--
5063
-- Table structure for table `hold_groups`
5064
--
5065
DROP TABLE IF EXISTS `hold_groups`;
5066
/*!40101 SET @saved_cs_client     = @@character_set_client */;
5067
/*!40101 SET character_set_client = utf8 */;
5068
CREATE TABLE hold_groups (
5069
    hold_group_id int unsigned NOT NULL AUTO_INCREMENT,
5070
    PRIMARY KEY (hold_group_id)
5071
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5072
/*!40101 SET character_set_client = @saved_cs_client */;
5073
5062
--
5074
--
5063
-- Table structure for table `old_reserves`
5075
-- Table structure for table `old_reserves`
5064
--
5076
--
Lines 5093-5098 CREATE TABLE `old_reserves` ( Link Here
5093
  `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
5105
  `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
5094
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
5106
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
5095
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
5107
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
5108
  `hold_group_id` int unsigned NULL DEFAULT NULL COMMENT 'The id of a group of titles reservations fulfilled when one title is picked',
5096
  PRIMARY KEY (`reserve_id`),
5109
  PRIMARY KEY (`reserve_id`),
5097
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
5110
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
5098
  KEY `old_reserves_biblionumber` (`biblionumber`),
5111
  KEY `old_reserves_biblionumber` (`biblionumber`),
Lines 5105-5111 CREATE TABLE `old_reserves` ( Link Here
5105
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
5118
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
5106
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
5119
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
5107
  CONSTRAINT `old_reserves_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
5120
  CONSTRAINT `old_reserves_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
5108
  CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
5121
  CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL,
5122
  CONSTRAINT `old_reserves_ibfk_hg` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
5109
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5123
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5110
/*!40101 SET character_set_client = @saved_cs_client */;
5124
/*!40101 SET character_set_client = @saved_cs_client */;
5111
5125
Lines 5662-5667 CREATE TABLE `reserves` ( Link Here
5662
  `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
5676
  `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
5663
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
5677
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
5664
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
5678
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
5679
  `hold_group_id` int unsigned NULL DEFAULT NULL COMMENT 'The id of a group of titles reservations fulfilled when one title is picked',
5665
  PRIMARY KEY (`reserve_id`),
5680
  PRIMARY KEY (`reserve_id`),
5666
  KEY `priorityfoundidx` (`priority`,`found`),
5681
  KEY `priorityfoundidx` (`priority`,`found`),
5667
  KEY `borrowernumber` (`borrowernumber`),
5682
  KEY `borrowernumber` (`borrowernumber`),
Lines 5677-5683 CREATE TABLE `reserves` ( Link Here
5677
  CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5692
  CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5678
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
5693
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
5679
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5694
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5680
  CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE
5695
  CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5696
  CONSTRAINT `reserves_ibfk_hg` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE SET NULL ON UPDATE CASCADE
5681
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5697
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5682
/*!40101 SET character_set_client = @saved_cs_client */;
5698
/*!40101 SET character_set_client = @saved_cs_client */;
5683
5699
5684
- 

Return to bug 15516