Bugzilla – Attachment 138268 Details for
Bug 30650
Add a curbside pickup module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30650: Adjust atomic update
Bug-30650-Adjust-atomic-update.patch (text/plain), 7.03 KB, created by
Jonathan Druart
on 2022-07-29 09:32:02 UTC
(
hide
)
Description:
Bug 30650: Adjust atomic update
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-07-29 09:32:02 UTC
Size:
7.03 KB
patch
obsolete
>From bb7ed43810bd2c0cf1e63111d027970b5ca4e2c3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 29 Apr 2022 17:52:18 +0200 >Subject: [PATCH] Bug 30650: Adjust atomic update > >Take into account existing installs using the plugins > >Sponsored-by: Association KohaLa - https://koha-fr.org/ > >Signed-off-by: Koha Team University Lyon 3 <koha@univ-lyon3.fr> >--- > .../data/mysql/atomicupdate/bug_30650.pl | 68 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 46 +++++-------- > 2 files changed, 85 insertions(+), 29 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_30650.pl b/installer/data/mysql/atomicupdate/bug_30650.pl >index 3b186f93ca9..e729382b87a 100755 >--- a/installer/data/mysql/atomicupdate/bug_30650.pl >+++ b/installer/data/mysql/atomicupdate/bug_30650.pl >@@ -51,6 +51,74 @@ return { > } > ); > } >+ >+ unless ( TableExists('curbside_pickup_opening_slots') ) { >+ $dbh->do(q{ >+ CREATE TABLE `curbside_pickup_opening_slots` ( >+ `id` INT(11) NOT NULL AUTO_INCREMENT, >+ `curbside_pickup_policy_id` INT(11) NOT NULL, >+ `day` INT(1) NOT NULL, >+ `start_hour` INT(2) NOT NULL, >+ `start_minute` INT(2) NOT NULL, >+ `end_hour` INT(2) NOT NULL, >+ `end_minute` INT(2) NOT NULL, >+ PRIMARY KEY (`id`), >+ FOREIGN KEY (curbside_pickup_policy_id) REFERENCES curbside_pickup_policy(id) ON DELETE CASCADE ON UPDATE CASCADE >+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ }); >+ my $existing_slots = $dbh->selectall_arrayref(q{SELECT * FROM curbside_pickup_policy}, { Slice => {} }); >+ 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 (?, ?, ?, ?, ?, ?)}); >+ for my $slot ( @$existing_slots ) { >+ my $day_i = 0; >+ for my $day ( qw( sunday monday tuesday wednesday thursday friday saturday ) ) { >+ my $start_hour = $slot->{$day . '_start_hour'}; >+ my $start_minute = $slot->{$day . '_start_minute'}; >+ my $end_hour = $slot->{$day . '_end_hour'}; >+ my $end_minute = $slot->{$day . '_end_minute'}; >+ next unless $start_hour && $start_minute && $end_hour && $end_minute; >+ $insert_sth->execute($slot->{id}, $day_i, $start_hour, $start_minute, $end_hour, $end_minute); >+ $day_i++; >+ } >+ } >+ $dbh->do(q{ >+ ALTER TABLE curbside_pickup_policy >+ DROP COLUMN sunday_start_hour, >+ DROP COLUMN sunday_start_minute, >+ DROP COLUMN sunday_end_hour, >+ DROP COLUMN sunday_end_minute, >+ >+ DROP COLUMN monday_start_hour, >+ DROP COLUMN monday_start_minute, >+ DROP COLUMN monday_end_hour, >+ DROP COLUMN monday_end_minute, >+ >+ DROP COLUMN tuesday_start_hour, >+ DROP COLUMN tuesday_start_minute, >+ DROP COLUMN tuesday_end_hour, >+ DROP COLUMN tuesday_end_minute, >+ >+ DROP COLUMN wednesday_start_hour, >+ DROP COLUMN wednesday_start_minute, >+ DROP COLUMN wednesday_end_hour, >+ DROP COLUMN wednesday_end_minute, >+ >+ DROP COLUMN thursday_start_hour, >+ DROP COLUMN thursday_start_minute, >+ DROP COLUMN thursday_end_hour, >+ DROP COLUMN thursday_end_minute, >+ >+ DROP COLUMN friday_start_hour, >+ DROP COLUMN friday_start_minute, >+ DROP COLUMN friday_end_hour, >+ DROP COLUMN friday_end_minute, >+ >+ DROP COLUMN saturday_start_hour, >+ DROP COLUMN saturday_start_minute, >+ DROP COLUMN saturday_end_hour, >+ DROP COLUMN saturday_end_minute >+ }); >+ } >+ > unless ( TableExists('curbside_pickups') ) { > > $dbh->do( >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index e6d78e83c77..f53e0ab0bd5 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2336,40 +2336,28 @@ CREATE TABLE `curbside_pickup_policy` ( > `pickup_interval` INT(2) NOT NULL DEFAULT 0, > `patrons_per_interval` INT(2) NOT NULL DEFAULT 0, > `patron_scheduled_pickup` TINYINT(1) NOT NULL DEFAULT 0, >- `sunday_start_hour` INT(2) NULL DEFAULT NULL, >- `sunday_start_minute` INT(2) NULL DEFAULT NULL, >- `sunday_end_hour` INT(2) NULL DEFAULT NULL, >- `sunday_end_minute` INT(2) NULL DEFAULT NULL, >- `monday_start_hour` INT(2) NULL DEFAULT NULL, >- `monday_start_minute` INT(2) NULL DEFAULT NULL, >- `monday_end_hour` INT(2) NULL DEFAULT NULL, >- `monday_end_minute` INT(2) NULL DEFAULT NULL, >- `tuesday_start_hour` INT(2) NULL DEFAULT NULL, >- `tuesday_start_minute` INT(2) NULL DEFAULT NULL, >- `tuesday_end_hour` INT(2) NULL DEFAULT NULL, >- `tuesday_end_minute` INT(2) NULL DEFAULT NULL, >- `wednesday_start_hour` INT(2) NULL DEFAULT NULL, >- `wednesday_start_minute` INT(2) NULL DEFAULT NULL, >- `wednesday_end_hour` INT(2) NULL DEFAULT NULL, >- `wednesday_end_minute` INT(2) NULL DEFAULT NULL, >- `thursday_start_hour` INT(2) NULL DEFAULT NULL, >- `thursday_start_minute` INT(2) NULL DEFAULT NULL, >- `thursday_end_hour` INT(2) NULL DEFAULT NULL, >- `thursday_end_minute` INT(2) NULL DEFAULT NULL, >- `friday_start_hour` INT(2) NULL DEFAULT NULL, >- `friday_start_minute` INT(2) NULL DEFAULT NULL, >- `friday_end_hour` INT(2) NULL DEFAULT NULL, >- `friday_end_minute` INT(2) NULL DEFAULT NULL, >- `saturday_start_hour` INT(2) NULL DEFAULT NULL, >- `saturday_start_minute` INT(2) NULL DEFAULT NULL, >- `saturday_end_hour` INT(2) NULL DEFAULT NULL, >- `saturday_end_minute` INT(2) NULL DEFAULT NULL, >- `patron_scheduled_pickup` TINYINT(1) NOT NULL DEFAULT 0, > PRIMARY KEY (`id`), > UNIQUE KEY (`branchcode`), > FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > >+-- >+-- Table structure for table `curbside_pickup_opening_slots` >+-- >+ >+DROP TABLE IF EXISTS `curbside_pickup_opening_slots`; >+CREATE TABLE `curbside_pickup_opening_slots` ( >+ `id` INT(11) NOT NULL AUTO_INCREMENT, >+ `curbside_pickup_policy_id` INT(11) NOT NULL, >+ `day` TINYINT(1) NOT NULL, >+ `start_hour` INT(2) NOT NULL, >+ `start_minute` INT(2) NOT NULL, >+ `end_hour` INT(2) NOT NULL, >+ `end_minute` INT(2) NOT NULL, >+ PRIMARY KEY (`id`), >+ FOREIGN KEY (curbside_pickup_policy_id) REFERENCES curbside_pickup_policy(id) ON DELETE CASCADE ON UPDATE CASCADE >+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ > -- > -- Table structure for table `curbside_pickups` > -- >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30650
:
136584
|
136585
|
136586
|
136587
|
136588
|
136589
|
136590
|
136591
|
136592
|
136593
|
136594
|
136595
|
136596
|
136597
|
136598
|
136599
|
136600
|
136601
|
136602
|
136603
|
136604
|
136605
|
136606
|
136607
|
136608
|
136609
|
136610
|
137095
|
137100
|
137199
|
137211
|
137212
|
137277
|
137278
|
137279
|
137280
|
137281
|
137282
|
137283
|
137284
|
137285
|
137286
|
137287
|
137288
|
137289
|
137290
|
137291
|
137292
|
137293
|
137294
|
137295
|
137296
|
137297
|
137298
|
137299
|
137300
|
137301
|
137302
|
137303
|
137304
|
137305
|
137306
|
137307
|
138261
|
138262
|
138263
|
138264
|
138265
|
138266
|
138267
|
138268
|
138269
|
138270
|
138271
|
138272
|
138273
|
138274
|
138275
|
138276
|
138277
|
138278
|
138279
|
138280
|
138281
|
138282
|
138283
|
138284
|
138285
|
138286
|
138287
|
138288
|
138289
|
138290
|
138291
|
138292
|
138319
|
138320
|
138321
|
138322
|
138323
|
138324
|
138325
|
138330
|
138331
|
138332
|
138333
|
138334
|
138335
|
138336
|
138337
|
138338
|
138339
|
138340
|
138341
|
138342
|
138343
|
138344
|
138345
|
138346
|
138347
|
138348
|
138349
|
138350
|
138351
|
138352
|
138353
|
138354
|
138355
|
138356
|
138357
|
138358
|
138359
|
138360
|
138361
|
138362
|
138363
|
138364
|
138365
|
138366
|
138367
|
138368
|
138369
|
138375
|
138401
|
138610