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

(-)a/installer/data/mysql/atomicupdate/bug_29002.pl (+29 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
        if( !TableExists( 'bookings' ) ) {
10
            $dbh->do(q{
11
                CREATE TABLE `bookings` (
12
                  `booking_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
13
                  `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this booking is for',
14
                  `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this booking is on',
15
                  `item_id` 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 `patron_id` (`patron_id`),
20
                KEY `biblio_id` (`biblio_id`),
21
                KEY `item_id` (`item_id`),
22
                CONSTRAINT `bookings_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
23
                CONSTRAINT `bookings_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
24
                CONSTRAINT `bookings_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
25
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
26
            });
27
        }
28
    },
29
}
(-)a/installer/data/mysql/kohastructure.sql (-1 / +24 lines)
Lines 1154-1159 CREATE TABLE `biblioitems` ( Link Here
1154
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1154
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1155
/*!40101 SET character_set_client = @saved_cs_client */;
1155
/*!40101 SET character_set_client = @saved_cs_client */;
1156
1156
1157
--
1158
-- Table structure for table `bookings`
1159
--
1160
1161
DROP TABLE IF EXISTS `bookings`;
1162
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1163
/*!40101 SET character_set_client = utf8 */;
1164
CREATE TABLE `bookings` (
1165
  `booking_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
1166
  `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this booking is for',
1167
  `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this booking is on',
1168
  `item_id` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed a booking for',
1169
  `start_date` datetime DEFAULT NULL COMMENT 'the start date of the booking',
1170
  `end_date` datetime DEFAULT NULL COMMENT 'the end date of the booking',
1171
  PRIMARY KEY (`booking_id`),
1172
  KEY `patron_id` (`patron_id`),
1173
  KEY `biblio_id` (`biblio_id`),
1174
  KEY `item_id` (`item_id`),
1175
  CONSTRAINT `bookings_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1176
  CONSTRAINT `bookings_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1177
  CONSTRAINT `bookings_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1178
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1179
/*!40101 SET character_set_client = @saved_cs_client */;
1180
1157
--
1181
--
1158
-- Table structure for table `borrower_attribute_types`
1182
-- Table structure for table `borrower_attribute_types`
1159
--
1183
--
1160
- 

Return to bug 29002