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

(-)a/installer/data/mysql/atomicupdate/bug_36120.pl (+20 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "36120",
5
    description => "Add pickup location to bookings",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        unless ( column_exists( 'bookings', 'pickup_library_id' ) ) {
11
          $dbh->do(q{
12
              ALTER TABLE bookings
13
              ADD COLUMN `pickup_library_id` varchar(10) DEFAULT NULL COMMENT 'Identifier for booking pickup library' AFTER `item_id`,
14
              ADD CONSTRAINT `bookings_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
15
          });
16
17
          say $out "Added column 'bookings.pickup_library_id'";
18
        }
19
    },
20
};
(-)a/installer/data/mysql/kohastructure.sql (-2 / +3 lines)
Lines 1208-1213 CREATE TABLE `bookings` ( Link Here
1208
  `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this booking is for',
1208
  `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this booking is for',
1209
  `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this booking is on',
1209
  `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this booking is on',
1210
  `item_id` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed a booking for',
1210
  `item_id` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed a booking for',
1211
  `pickup_library_id` varchar(10) DEFAULT NULL COMMENT 'Identifier for booking pickup library',
1211
  `start_date` datetime DEFAULT NULL COMMENT 'the start date of the booking',
1212
  `start_date` datetime DEFAULT NULL COMMENT 'the start date of the booking',
1212
  `end_date` datetime DEFAULT NULL COMMENT 'the end date of the booking',
1213
  `end_date` datetime DEFAULT NULL COMMENT 'the end date of the booking',
1213
  PRIMARY KEY (`booking_id`),
1214
  PRIMARY KEY (`booking_id`),
Lines 1216-1222 CREATE TABLE `bookings` ( Link Here
1216
  KEY `item_id` (`item_id`),
1217
  KEY `item_id` (`item_id`),
1217
  CONSTRAINT `bookings_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1218
  CONSTRAINT `bookings_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1218
  CONSTRAINT `bookings_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1219
  CONSTRAINT `bookings_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1219
  CONSTRAINT `bookings_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1220
  CONSTRAINT `bookings_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1221
  CONSTRAINT `bookings_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1220
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1222
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1221
/*!40101 SET character_set_client = @saved_cs_client */;
1223
/*!40101 SET character_set_client = @saved_cs_client */;
1222
1224
1223
- 

Return to bug 36120