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

(-)a/installer/data/mysql/atomicupdate/bug_15516_-_hold_group_table.pl (+27 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(q{CREATE TABLE hold_groups (
12
                hold_group_id int unsigned NOT NULL AUTO_INCREMENT,
13
                PRIMARY KEY (hold_group_id)
14
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci});
15
        }
16
17
        unless( column_exists( 'reserves', 'hold_group_id' ) ) {
18
            $dbh->do(q{ALTER TABLE reserves ADD COLUMN hold_group_id int unsigned NULL DEFAULT NULL AFTER non_priority});
19
            $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});
20
        }
21
22
        unless( column_exists( 'old_reserves', 'hold_group_id') ) {
23
            $dbh->do(q{ALTER TABLE old_reserves ADD COLUMN hold_group_id int unsigned NULL DEFAULT NULL AFTER non_priority});
24
            $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});
25
        }
26
    },
27
};
(-)a/installer/data/mysql/kohastructure.sql (-3 / +18 lines)
Lines 4072-4077 CREATE TABLE `old_issues` ( Link Here
4072
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4072
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4073
/*!40101 SET character_set_client = @saved_cs_client */;
4073
/*!40101 SET character_set_client = @saved_cs_client */;
4074
4074
4075
--
4076
-- Table structure for table `hold_groups`
4077
--
4078
DROP TABLE IF EXISTS `hold_groups`;
4079
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4080
/*!40101 SET character_set_client = utf8 */;
4081
CREATE TABLE hold_groups (
4082
    hold_group_id int unsigned NOT NULL AUTO_INCREMENT,
4083
    PRIMARY KEY (hold_group_id)
4084
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4085
/*!40101 SET character_set_client = @saved_cs_client */;
4086
4075
--
4087
--
4076
-- Table structure for table `old_reserves`
4088
-- Table structure for table `old_reserves`
4077
--
4089
--
Lines 4104-4109 CREATE TABLE `old_reserves` ( Link Here
4104
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4116
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4105
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4117
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4106
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4118
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4119
  `hold_group_id` int unsigned NULL DEFAULT NULL COMMENT 'The id of a group of titles reservations fulfilled when one title is picked',
4107
  PRIMARY KEY (`reserve_id`),
4120
  PRIMARY KEY (`reserve_id`),
4108
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
4121
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
4109
  KEY `old_reserves_biblionumber` (`biblionumber`),
4122
  KEY `old_reserves_biblionumber` (`biblionumber`),
Lines 4113-4119 CREATE TABLE `old_reserves` ( Link Here
4113
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4126
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4114
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4127
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4115
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4128
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4116
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL
4129
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
4130
  CONSTRAINT `old_reserves_ibfk_5` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
4117
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4131
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4118
/*!40101 SET character_set_client = @saved_cs_client */;
4132
/*!40101 SET character_set_client = @saved_cs_client */;
4119
4133
Lines 4550-4555 CREATE TABLE `reserves` ( Link Here
4550
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4564
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4551
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4565
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4552
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4566
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4567
  `hold_group_id` int unsigned NULL DEFAULT NULL COMMENT 'The id of a group of titles reservations fulfilled when one title is picked',
4553
  PRIMARY KEY (`reserve_id`),
4568
  PRIMARY KEY (`reserve_id`),
4554
  KEY `priorityfoundidx` (`priority`,`found`),
4569
  KEY `priorityfoundidx` (`priority`,`found`),
4555
  KEY `borrowernumber` (`borrowernumber`),
4570
  KEY `borrowernumber` (`borrowernumber`),
Lines 4563-4569 CREATE TABLE `reserves` ( Link Here
4563
  CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4578
  CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4564
  CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4579
  CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4565
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4580
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4566
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE
4581
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
4582
  CONSTRAINT `reserves_ibfk_7` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE SET NULL ON UPDATE CASCADE
4567
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4583
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4568
/*!40101 SET character_set_client = @saved_cs_client */;
4584
/*!40101 SET character_set_client = @saved_cs_client */;
4569
4585
4570
- 

Return to bug 15516