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 (-1 / +16 lines)
Lines 4872-4877 CREATE TABLE `old_issues` ( Link Here
4872
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4872
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4873
/*!40101 SET character_set_client = @saved_cs_client */;
4873
/*!40101 SET character_set_client = @saved_cs_client */;
4874
4874
4875
--
4876
-- Table structure for table `hold_groups`
4877
--
4878
DROP TABLE IF EXISTS `hold_groups`;
4879
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4880
/*!40101 SET character_set_client = utf8 */;
4881
CREATE TABLE hold_groups (
4882
    hold_group_id int unsigned NOT NULL AUTO_INCREMENT,
4883
    PRIMARY KEY (hold_group_id)
4884
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4885
/*!40101 SET character_set_client = @saved_cs_client */;
4886
4875
--
4887
--
4876
-- Table structure for table `old_reserves`
4888
-- Table structure for table `old_reserves`
4877
--
4889
--
Lines 4905-4910 CREATE TABLE `old_reserves` ( Link Here
4905
  `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4917
  `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4906
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
4918
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
4907
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4919
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4920
  `hold_group_id` int unsigned NULL DEFAULT NULL COMMENT 'The id of a group of titles reservations fulfilled when one title is picked',
4908
  PRIMARY KEY (`reserve_id`),
4921
  PRIMARY KEY (`reserve_id`),
4909
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
4922
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
4910
  KEY `old_reserves_biblionumber` (`biblionumber`),
4923
  KEY `old_reserves_biblionumber` (`biblionumber`),
Lines 4917-4922 CREATE TABLE `old_reserves` ( Link Here
4917
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4930
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4918
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
4931
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
4919
  CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
4932
  CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
4933
  CONSTRAINT `old_reserves_ibfk_hg` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
4920
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4934
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4921
/*!40101 SET character_set_client = @saved_cs_client */;
4935
/*!40101 SET character_set_client = @saved_cs_client */;
4922
4936
Lines 5455-5460 CREATE TABLE `reserves` ( Link Here
5455
  `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
5469
  `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
5456
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
5470
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
5457
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
5471
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
5472
  `hold_group_id` int unsigned NULL DEFAULT NULL COMMENT 'The id of a group of titles reservations fulfilled when one title is picked',
5458
  PRIMARY KEY (`reserve_id`),
5473
  PRIMARY KEY (`reserve_id`),
5459
  KEY `priorityfoundidx` (`priority`,`found`),
5474
  KEY `priorityfoundidx` (`priority`,`found`),
5460
  KEY `borrowernumber` (`borrowernumber`),
5475
  KEY `borrowernumber` (`borrowernumber`),
Lines 5471-5476 CREATE TABLE `reserves` ( Link Here
5471
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
5486
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
5472
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5487
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5473
  CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE
5488
  CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE
5489
  CONSTRAINT `reserves_ibfk_hg` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE SET NULL ON UPDATE CASCADE
5474
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5490
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5475
/*!40101 SET character_set_client = @saved_cs_client */;
5491
/*!40101 SET character_set_client = @saved_cs_client */;
5476
5492
5477
- 

Return to bug 15516