Bugzilla – Attachment 156556 Details for
Bug 30719
ILL should provide the ability to create batch requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30719: Atomic update fixes
Bug-30719-Atomic-update-fixes.patch (text/plain), 7.67 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-10-04 20:16:19 UTC
(
hide
)
Description:
Bug 30719: Atomic update fixes
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-10-04 20:16:19 UTC
Size:
7.67 KB
patch
obsolete
>From 5e9ea26484a187ac731ae66bab6ee33dea3c6cc4 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 4 Oct 2023 15:53:41 -0400 >Subject: [PATCH] Bug 30719: Atomic update fixes > >--- > .../atomicupdate/bug_30719_add_ill_batches.pl | 94 ++++++++++--------- > 1 file changed, 48 insertions(+), 46 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_30719_add_ill_batches.pl b/installer/data/mysql/atomicupdate/bug_30719_add_ill_batches.pl >index c3a378b69ca..4bc079f4233 100755 >--- a/installer/data/mysql/atomicupdate/bug_30719_add_ill_batches.pl >+++ b/installer/data/mysql/atomicupdate/bug_30719_add_ill_batches.pl >@@ -2,39 +2,49 @@ use Modern::Perl; > > return { > bug_number => "30719", >- description => "Add ILL batches", >+ description => "Add ability to create batch ILL requests", > up => sub { > my ($args) = @_; > my ( $dbh, $out ) = @$args{qw(dbh out)}; >- $dbh->do( >- q{ >- CREATE TABLE IF NOT EXISTS `illbatch_statuses` ( >- `id` int(11) NOT NULL auto_increment COMMENT "Status ID", >- `name` varchar(100) NOT NULL COMMENT "Name of status", >- `code` varchar(20) NOT NULL COMMENT "Unique, immutable code for status", >- `is_system` tinyint(1) COMMENT "Is this status required for system operation", >- PRIMARY KEY (`id`), >- UNIQUE KEY `u_illbatchstatuses__code` (`code`) >- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci >+ >+ unless ( TableExists('illbatch_statuses') ) { >+ $dbh->do( >+ q{ >+ CREATE TABLE`illbatch_statuses` ( >+ `id` int(11) NOT NULL auto_increment COMMENT "Status ID", >+ `name` varchar(100) NOT NULL COMMENT "Name of status", >+ `code` varchar(20) NOT NULL COMMENT "Unique, immutable code for status", >+ `is_system` tinyint(1) COMMENT "Is this status required for system operation", >+ PRIMARY KEY (`id`), >+ UNIQUE KEY `u_illbatchstatuses__code` (`code`) >+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci >+ } >+ ); >+ >+ say $out "Added new table 'illbatch_statuses'"; > } >- ); >- $dbh->do( >- q{ >- CREATE TABLE IF NOT EXISTS `illbatches` ( >- `id` int(11) NOT NULL auto_increment COMMENT "Batch ID", >- `name` varchar(100) NOT NULL COMMENT "Unique name of batch", >- `backend` varchar(20) NOT NULL COMMENT "Name of batch backend", >- `borrowernumber` int(11) COMMENT "Patron associated with batch", >- `branchcode` varchar(50) COMMENT "Branch associated with batch", >- `statuscode` varchar(20) COMMENT "Status of batch", >- PRIMARY KEY (`id`), >- UNIQUE KEY `u_illbatches__name` (`name`), >- CONSTRAINT `illbatches_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE, >- CONSTRAINT `illbatches_bcfk` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE, >- CONSTRAINT `illbatches_sfk` FOREIGN KEY (`statuscode`) REFERENCES `illbatch_statuses` (`code`) ON DELETE SET NULL ON UPDATE CASCADE >- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci >+ >+ unless ( TableExists('illbatches') ) { >+ $dbh->do( >+ q{ >+ CREATE TABLE `illbatches` ( >+ `id` int(11) NOT NULL auto_increment COMMENT "Batch ID", >+ `name` varchar(100) NOT NULL COMMENT "Unique name of batch", >+ `backend` varchar(20) NOT NULL COMMENT "Name of batch backend", >+ `borrowernumber` int(11) COMMENT "Patron associated with batch", >+ `branchcode` varchar(50) COMMENT "Branch associated with batch", >+ `statuscode` varchar(20) COMMENT "Status of batch", >+ PRIMARY KEY (`id`), >+ UNIQUE KEY `u_illbatches__name` (`name`), >+ CONSTRAINT `illbatches_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE, >+ CONSTRAINT `illbatches_bcfk` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE, >+ CONSTRAINT `illbatches_sfk` FOREIGN KEY (`statuscode`) REFERENCES `illbatch_statuses` (`code`) ON DELETE SET NULL ON UPDATE CASCADE >+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci >+ } >+ ); >+ >+ say $out "Added new table 'illbatches'"; > } >- ); > unless ( column_exists( 'illrequests', 'batch_id' ) ) { > $dbh->do( > q{ >@@ -42,6 +52,8 @@ return { > ADD COLUMN `batch_id` int(11) AFTER backend -- Optional ID of batch that this request belongs to > } > ); >+ >+ say $out "Added column 'illrequests.batch_id'"; > } > > unless ( foreign_key_exists( 'illrequests', 'illrequests_ibfk' ) ) { >@@ -87,15 +99,13 @@ return { > | > ); > >- if ($new_status) { >- say $out "Bug 30719: NEW ILL batch status found. Update has already been run."; >- } else { >+ unless ($new_status) { > $dbh->do( > qq{ > INSERT INTO illbatch_statuses ( name, code, is_system ) VALUES ('New', 'NEW', '1') > } > ); >- say $out "Bug 30719: Added NEW ILL batch status"; >+ say $out "Added new ILL batch status 'NEW'"; > } > > # Get any existing IN_PROGRESS batch status >@@ -105,15 +115,13 @@ return { > | > ); > >- if ($in_progress_status) { >- say $out "Bug 30719: IN_PROGRESS ILL batch status found. Update has already been run."; >- } else { >+ unless ($in_progress_status) { > $dbh->do( > qq{ > INSERT INTO illbatch_statuses( name, code, is_system ) VALUES( 'In progress', 'IN_PROGRESS', '1' ) > } > ); >- say $out "Bug 30719: Added IN_PROGRESS ILL batch status"; >+ say $out "Added new ILL batch status 'IN_PROGRESS'"; > } > > # Get any existing COMPLETED batch status >@@ -123,15 +131,13 @@ return { > | > ); > >- if ($completed_status) { >- say $out "Bug 30719: COMPLETED ILL batch status found. Update has already been run."; >- } else { >+ unless ($completed_status) { > $dbh->do( > qq{ > INSERT INTO illbatch_statuses( name, code, is_system ) VALUES( 'Completed', 'COMPLETED', '1' ) > } > ); >- say $out "Bug 30719: Added COMPLETED ILL batch status"; >+ say $out "Added new ILL batch status 'COMPLETED'"; > } > > # Get any existing UNKNOWN batch status >@@ -141,17 +147,13 @@ return { > | > ); > >- if ($unknown_status) { >- say $out "Bug 30719: UNKNOWN ILL batch status found. Update has already been run."; >- } else { >+ unless ($unknown_status) { > $dbh->do( > qq{ > INSERT INTO illbatch_statuses( name, code, is_system ) VALUES( 'Unknown', 'UNKNOWN', '1' ) > } > ); >- say $out "Bug 30719: Added UNKNOWN ILL batch status"; >+ say $out "Added new ILL batch status 'UNKNOWN'"; > } >- >- say $out "Bug 30719: Add ILL batches completed"; > }, > }; >-- >2.42.0
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 30719
:
144281
|
144285
|
144286
|
144287
|
144288
|
144289
|
144290
|
144291
|
144292
|
144293
|
144294
|
144295
|
144296
|
144297
|
144298
|
144299
|
144300
|
144301
|
144302
|
145760
|
145869
|
145870
|
145876
|
145934
|
146152
|
147658
|
147929
|
147930
|
147931
|
147932
|
147933
|
147934
|
147952
|
147953
|
147954
|
147955
|
147956
|
151152
|
151153
|
151154
|
151155
|
151156
|
151284
|
151285
|
151286
|
151287
|
151288
|
151303
|
151304
|
151305
|
151306
|
151307
|
151308
|
151309
|
151310
|
151311
|
151312
|
151513
|
151514
|
151515
|
151516
|
151517
|
151519
|
151520
|
151521
|
151522
|
151523
|
151571
|
151572
|
151573
|
151574
|
151575
|
151611
|
151612
|
151613
|
151614
|
151615
|
151804
|
151805
|
151806
|
151807
|
151808
|
151809
|
154046
|
154047
|
154048
|
154049
|
154050
|
154051
|
154052
|
155421
|
155422
|
155423
|
155424
|
155425
|
155426
|
155427
|
155428
|
155429
|
155430
|
155431
|
155432
|
155433
|
155434
|
155435
| 156556 |
156748
|
156749
|
156752
|
156783
|
156785
|
156811
|
156812
|
156827
|
156828