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

(-)a/installer/data/mysql/atomicupdate/bug_30650.pl (+68 lines)
Lines 51-56 return { Link Here
51
        }
51
        }
52
            );
52
            );
53
        }
53
        }
54
55
        unless ( TableExists('curbside_pickup_opening_slots') ) {
56
            $dbh->do(q{
57
                CREATE TABLE `curbside_pickup_opening_slots` (
58
                    `id` INT(11) NOT NULL AUTO_INCREMENT,
59
                    `curbside_pickup_policy_id` INT(11) NOT NULL,
60
                    `day` INT(1) NOT NULL,
61
                    `start_hour` INT(2) NOT NULL,
62
                    `start_minute` INT(2) NOT NULL,
63
                    `end_hour` INT(2) NOT NULL,
64
                    `end_minute` INT(2) NOT NULL,
65
                    PRIMARY KEY (`id`),
66
                    FOREIGN KEY (curbside_pickup_policy_id) REFERENCES curbside_pickup_policy(id) ON DELETE CASCADE ON UPDATE CASCADE
67
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
68
            });
69
            my $existing_slots = $dbh->selectall_arrayref(q{SELECT * FROM curbside_pickup_policy}, { Slice => {} });
70
            my $insert_sth = $dbh->prepare(q{INSERT INTO curbside_pickup_opening_slots ( curbside_pickup_policy_id, day, start_hour, start_minute, end_hour, end_minute ) VALUES (?, ?, ?, ?, ?, ?)});
71
            for my $slot ( @$existing_slots ) {
72
                my $day_i = 0;
73
                for my $day ( qw( sunday monday tuesday wednesday thursday friday saturday ) ) {
74
                    my $start_hour = $slot->{$day . '_start_hour'};
75
                    my $start_minute = $slot->{$day . '_start_minute'};
76
                    my $end_hour = $slot->{$day . '_end_hour'};
77
                    my $end_minute = $slot->{$day . '_end_minute'};
78
                    next unless $start_hour && $start_minute && $end_hour && $end_minute;
79
                    $insert_sth->execute($slot->{id}, $day_i, $start_hour, $start_minute, $end_hour, $end_minute);
80
                    $day_i++;
81
                }
82
            }
83
            $dbh->do(q{
84
                ALTER TABLE curbside_pickup_policy
85
                DROP COLUMN sunday_start_hour,
86
                DROP COLUMN sunday_start_minute,
87
                DROP COLUMN sunday_end_hour,
88
                DROP COLUMN sunday_end_minute,
89
90
                DROP COLUMN monday_start_hour,
91
                DROP COLUMN monday_start_minute,
92
                DROP COLUMN monday_end_hour,
93
                DROP COLUMN monday_end_minute,
94
95
                DROP COLUMN tuesday_start_hour,
96
                DROP COLUMN tuesday_start_minute,
97
                DROP COLUMN tuesday_end_hour,
98
                DROP COLUMN tuesday_end_minute,
99
100
                DROP COLUMN wednesday_start_hour,
101
                DROP COLUMN wednesday_start_minute,
102
                DROP COLUMN wednesday_end_hour,
103
                DROP COLUMN wednesday_end_minute,
104
105
                DROP COLUMN thursday_start_hour,
106
                DROP COLUMN thursday_start_minute,
107
                DROP COLUMN thursday_end_hour,
108
                DROP COLUMN thursday_end_minute,
109
110
                DROP COLUMN friday_start_hour,
111
                DROP COLUMN friday_start_minute,
112
                DROP COLUMN friday_end_hour,
113
                DROP COLUMN friday_end_minute,
114
115
                DROP COLUMN saturday_start_hour,
116
                DROP COLUMN saturday_start_minute,
117
                DROP COLUMN saturday_end_hour,
118
                DROP COLUMN saturday_end_minute
119
            });
120
        }
121
54
        unless ( TableExists('curbside_pickups') ) {
122
        unless ( TableExists('curbside_pickups') ) {
55
123
56
            $dbh->do(
124
            $dbh->do(
(-)a/installer/data/mysql/kohastructure.sql (-30 / +17 lines)
Lines 2305-2344 CREATE TABLE `curbside_pickup_policy` ( Link Here
2305
  `pickup_interval` INT(2) NOT NULL DEFAULT 0,
2305
  `pickup_interval` INT(2) NOT NULL DEFAULT 0,
2306
  `patrons_per_interval` INT(2) NOT NULL DEFAULT 0,
2306
  `patrons_per_interval` INT(2) NOT NULL DEFAULT 0,
2307
  `patron_scheduled_pickup` TINYINT(1) NOT NULL DEFAULT 0,
2307
  `patron_scheduled_pickup` TINYINT(1) NOT NULL DEFAULT 0,
2308
  `sunday_start_hour` INT(2) NULL DEFAULT NULL,
2309
  `sunday_start_minute` INT(2) NULL DEFAULT NULL,
2310
  `sunday_end_hour` INT(2) NULL DEFAULT NULL,
2311
  `sunday_end_minute` INT(2) NULL DEFAULT NULL,
2312
  `monday_start_hour` INT(2) NULL DEFAULT NULL,
2313
  `monday_start_minute` INT(2) NULL DEFAULT NULL,
2314
  `monday_end_hour` INT(2) NULL DEFAULT NULL,
2315
  `monday_end_minute` INT(2) NULL DEFAULT NULL,
2316
  `tuesday_start_hour` INT(2) NULL DEFAULT NULL,
2317
  `tuesday_start_minute` INT(2) NULL DEFAULT NULL,
2318
  `tuesday_end_hour` INT(2) NULL DEFAULT NULL,
2319
  `tuesday_end_minute` INT(2) NULL DEFAULT NULL,
2320
  `wednesday_start_hour` INT(2) NULL DEFAULT NULL,
2321
  `wednesday_start_minute` INT(2) NULL DEFAULT NULL,
2322
  `wednesday_end_hour` INT(2) NULL DEFAULT NULL,
2323
  `wednesday_end_minute` INT(2) NULL DEFAULT NULL,
2324
  `thursday_start_hour` INT(2) NULL DEFAULT NULL,
2325
  `thursday_start_minute` INT(2) NULL DEFAULT NULL,
2326
  `thursday_end_hour` INT(2) NULL DEFAULT NULL,
2327
  `thursday_end_minute` INT(2) NULL DEFAULT NULL,
2328
  `friday_start_hour` INT(2) NULL DEFAULT NULL,
2329
  `friday_start_minute` INT(2) NULL DEFAULT NULL,
2330
  `friday_end_hour` INT(2) NULL DEFAULT NULL,
2331
  `friday_end_minute` INT(2) NULL DEFAULT NULL,
2332
  `saturday_start_hour` INT(2) NULL DEFAULT NULL,
2333
  `saturday_start_minute` INT(2) NULL DEFAULT NULL,
2334
  `saturday_end_hour` INT(2) NULL DEFAULT NULL,
2335
  `saturday_end_minute` INT(2) NULL DEFAULT NULL,
2336
  `patron_scheduled_pickup` TINYINT(1) NOT NULL DEFAULT 0,
2337
  PRIMARY KEY (`id`),
2308
  PRIMARY KEY (`id`),
2338
  UNIQUE KEY (`branchcode`),
2309
  UNIQUE KEY (`branchcode`),
2339
  FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE ON UPDATE CASCADE
2310
  FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE ON UPDATE CASCADE
2340
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2311
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2341
2312
2313
--
2314
-- Table structure for table `curbside_pickup_opening_slots`
2315
--
2316
2317
DROP TABLE IF EXISTS `curbside_pickup_opening_slots`;
2318
CREATE TABLE `curbside_pickup_opening_slots` (
2319
    `id` INT(11) NOT NULL AUTO_INCREMENT,
2320
    `curbside_pickup_policy_id` INT(11) NOT NULL,
2321
    `day` TINYINT(1) NOT NULL,
2322
    `start_hour` INT(2) NOT NULL,
2323
    `start_minute` INT(2) NOT NULL,
2324
    `end_hour` INT(2) NOT NULL,
2325
    `end_minute` INT(2) NOT NULL,
2326
    PRIMARY KEY (`id`),
2327
    FOREIGN KEY (curbside_pickup_policy_id) REFERENCES curbside_pickup_policy(id) ON DELETE CASCADE ON UPDATE CASCADE
2328
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2329
2342
--
2330
--
2343
-- Table structure for table `curbside_pickups`
2331
-- Table structure for table `curbside_pickups`
2344
--
2332
--
2345
- 

Return to bug 30650