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

(-)a/installer/data/mysql/atomicupdate/bug_29002.pl (+28 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "29002",
5
    description => "Add bookings table",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        # Do you stuffs here
10
        $dbh->do(q{
11
            CREATE TABLE `bookings` (
12
              `booking_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
13
              `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this booking is for',
14
              `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this booking is on',
15
              `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed a booking for',
16
              `start_date` datetime DEFAULT NULL COMMENT 'the start date of the booking',
17
              `end_date` datetime DEFAULT NULL COMMENT 'the end date of the booking',
18
            PRIMARY KEY (`booking_id`),
19
            KEY `borrowernumber` (`borrowernumber`),
20
            KEY `biblionumber` (`biblionumber`),
21
            KEY `itemnumber` (`itemnumber`),
22
            CONSTRAINT `bookings_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
23
            CONSTRAINT `bookings_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
24
            CONSTRAINT `bookings_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
25
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
26
        });
27
    },
28
}
(-)a/installer/data/mysql/kohastructure.sql (-1 / +24 lines)
Lines 1067-1072 CREATE TABLE `biblioitems` ( Link Here
1067
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1067
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1068
/*!40101 SET character_set_client = @saved_cs_client */;
1068
/*!40101 SET character_set_client = @saved_cs_client */;
1069
1069
1070
--
1071
-- Table structure for table `bookings`
1072
--
1073
1074
DROP TABLE IF EXISTS `bookings`;
1075
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1076
/*!40101 SET character_set_client = utf8 */;
1077
CREATE TABLE `bookings` (
1078
  `booking_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
1079
  `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this booking is for',
1080
  `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this booking is on',
1081
  `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed a booking for',
1082
  `start_date` datetime DEFAULT NULL COMMENT 'the start date of the booking',
1083
  `end_date` datetime DEFAULT NULL COMMENT 'the end date of the booking',
1084
  PRIMARY KEY (`booking_id`),
1085
  KEY `borrowernumber` (`borrowernumber`),
1086
  KEY `biblionumber` (`biblionumber`),
1087
  KEY `itemnumber` (`itemnumber`),
1088
  CONSTRAINT `bookings_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1089
  CONSTRAINT `bookings_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1090
  CONSTRAINT `bookings_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1091
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1092
/*!40101 SET character_set_client = @saved_cs_client */;
1093
1070
--
1094
--
1071
-- Table structure for table `borrower_attribute_types`
1095
-- Table structure for table `borrower_attribute_types`
1072
--
1096
--
1073
- 

Return to bug 29002