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 1224-1229 CREATE TABLE `bookings` ( Link Here
1224
  `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this booking is for',
1224
  `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this booking is for',
1225
  `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this booking is on',
1225
  `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this booking is on',
1226
  `item_id` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed a booking for',
1226
  `item_id` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed a booking for',
1227
  `pickup_library_id` varchar(10) DEFAULT NULL COMMENT 'Identifier for booking pickup library',
1227
  `start_date` datetime DEFAULT NULL COMMENT 'the start date of the booking',
1228
  `start_date` datetime DEFAULT NULL COMMENT 'the start date of the booking',
1228
  `end_date` datetime DEFAULT NULL COMMENT 'the end date of the booking',
1229
  `end_date` datetime DEFAULT NULL COMMENT 'the end date of the booking',
1229
  PRIMARY KEY (`booking_id`),
1230
  PRIMARY KEY (`booking_id`),
Lines 1232-1238 CREATE TABLE `bookings` ( Link Here
1232
  KEY `item_id` (`item_id`),
1233
  KEY `item_id` (`item_id`),
1233
  CONSTRAINT `bookings_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1234
  CONSTRAINT `bookings_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1234
  CONSTRAINT `bookings_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1235
  CONSTRAINT `bookings_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1235
  CONSTRAINT `bookings_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1236
  CONSTRAINT `bookings_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1237
  CONSTRAINT `bookings_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1236
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1238
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1237
/*!40101 SET character_set_client = @saved_cs_client */;
1239
/*!40101 SET character_set_client = @saved_cs_client */;
1238
1240
1239
- 

Return to bug 36120