Bugzilla – Attachment 89632 Details for
Bug 18928
Move `holdallowed`, `hold_fulfillment_policy` and `returnbranch` into the `circulation_rules` table.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18928: (follow-up) Make DB update idempotent
Bug-18928-follow-up-Make-DB-update-idempotent.patch (text/plain), 8.44 KB, created by
Jonathan Druart
on 2019-05-12 00:05:41 UTC
(
hide
)
Description:
Bug 18928: (follow-up) Make DB update idempotent
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-05-12 00:05:41 UTC
Size:
8.44 KB
patch
obsolete
>From ad6c5bdc62711bdda58af4db57ad10e229e5e623 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 6 Mar 2019 09:51:28 -0300 >Subject: [PATCH] Bug 18928: (follow-up) Make DB update idempotent > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Agustin Moyano <agustinmoyano@theke.io> > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >--- > installer/data/mysql/atomicupdate/bug_18928.perl | 145 ++++++++++++----------- > 1 file changed, 77 insertions(+), 68 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_18928.perl b/installer/data/mysql/atomicupdate/bug_18928.perl >index 3fcb9d1628..2ee59f36bd 100644 >--- a/installer/data/mysql/atomicupdate/bug_18928.perl >+++ b/installer/data/mysql/atomicupdate/bug_18928.perl >@@ -1,79 +1,88 @@ > $DBversion = 'XXX'; # will be replaced by the RM > if( CheckVersion( $DBversion ) ) { >- if ( column_exists( 'default_circ_rules', 'holdallowed' ) ) { >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, NULL, NULL, 'holdallowed', holdallowed >- FROM default_circ_rules >- "); >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, NULL, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy >- FROM default_circ_rules >- "); >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, NULL, NULL, 'returnbranch', returnbranch >- FROM default_circ_rules >- "); >- $dbh->do("DROP TABLE default_circ_rules"); >+ >+ if ( TableExists('default_circ_rules') ) { >+ if ( column_exists( 'default_circ_rules', 'holdallowed' ) ) { >+ $dbh->do(" >+ INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >+ SELECT NULL, NULL, NULL, 'holdallowed', holdallowed >+ FROM default_circ_rules >+ "); >+ $dbh->do(" >+ INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >+ SELECT NULL, NULL, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy >+ FROM default_circ_rules >+ "); >+ $dbh->do(" >+ INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >+ SELECT NULL, NULL, NULL, 'returnbranch', returnbranch >+ FROM default_circ_rules >+ "); >+ $dbh->do("DROP TABLE default_circ_rules"); >+ } > } > >- if ( column_exists( 'default_branch_circ_rules', 'holdallowed' ) ) { >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, branchcode, NULL, 'holdallowed', holdallowed >- FROM default_branch_circ_rules >- "); >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, branchcode, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy >- FROM default_branch_circ_rules >- "); >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, branchcode, NULL, 'returnbranch', returnbranch >- FROM default_branch_circ_rules >- "); >- $dbh->do("DROP TABLE default_branch_circ_rules"); >+ if ( TableExists('default_branch_circ_rules') ) { >+ if ( column_exists( 'default_branch_circ_rules', 'holdallowed' ) ) { >+ $dbh->do(" >+ INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >+ SELECT NULL, branchcode, NULL, 'holdallowed', holdallowed >+ FROM default_branch_circ_rules >+ "); >+ $dbh->do(" >+ INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >+ SELECT NULL, branchcode, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy >+ FROM default_branch_circ_rules >+ "); >+ $dbh->do(" >+ INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >+ SELECT NULL, branchcode, NULL, 'returnbranch', returnbranch >+ FROM default_branch_circ_rules >+ "); >+ $dbh->do("DROP TABLE default_branch_circ_rules"); >+ } > } > >- if ( column_exists( 'branch_item_rules', 'holdallowed' ) ) { >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, branchcode, itemtype, 'holdallowed', holdallowed >- FROM branch_item_rules >- "); >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, branchcode, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy >- FROM branch_item_rules >- "); >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, branchcode, itemtype, 'returnbranch', returnbranch >- FROM branch_item_rules >- "); >- $dbh->do("DROP TABLE branch_item_rules"); >+ if ( TableExists('branch_item_rules') ) { >+ if ( column_exists( 'branch_item_rules', 'holdallowed' ) ) { >+ $dbh->do(" >+ INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >+ SELECT NULL, branchcode, itemtype, 'holdallowed', holdallowed >+ FROM branch_item_rules >+ "); >+ $dbh->do(" >+ INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >+ SELECT NULL, branchcode, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy >+ FROM branch_item_rules >+ "); >+ $dbh->do(" >+ INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >+ SELECT NULL, branchcode, itemtype, 'returnbranch', returnbranch >+ FROM branch_item_rules >+ "); >+ $dbh->do("DROP TABLE branch_item_rules"); >+ } > } > >- if ( column_exists( 'default_branch_item_rules', 'holdallowed' ) ) { >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, NULL, itemtype, 'holdallowed', holdallowed >- FROM default_branch_item_rules >- "); >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, NULL, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy >- FROM default_branch_item_rules >- "); >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, NULL, itemtype, 'returnbranch', returnbranch >- FROM default_branch_item_rules >- "); >- $dbh->do("DROP TABLE default_branch_item_rules"); >+ if ( TableExists('default_branch_item_rules') ) { >+ if ( column_exists( 'default_branch_item_rules', 'holdallowed' ) ) { >+ $dbh->do(" >+ INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >+ SELECT NULL, NULL, itemtype, 'holdallowed', holdallowed >+ FROM default_branch_item_rules >+ "); >+ $dbh->do(" >+ INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >+ SELECT NULL, NULL, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy >+ FROM default_branch_item_rules >+ "); >+ $dbh->do(" >+ INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >+ SELECT NULL, NULL, itemtype, 'returnbranch', returnbranch >+ FROM default_branch_item_rules >+ "); >+ $dbh->do("DROP TABLE default_branch_item_rules"); >+ } > } > > SetVersion( $DBversion ); >-- >2.11.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 18928
:
65241
|
65242
|
71005
|
71006
|
81096
|
81097
|
81098
|
81099
|
82933
|
82934
|
82935
|
82936
|
85487
|
85488
|
85489
|
85490
|
85491
|
86134
|
86135
|
86136
|
86137
|
86138
|
86139
|
88659
|
89017
|
89018
|
89019
|
89020
|
89021
|
89022
|
89023
|
89024
|
89333
|
89334
|
89336
|
89338
|
89339
|
89340
|
89341
|
89342
|
89343
|
89344
|
89345
|
89346
|
89347
|
89348
|
89349
|
89377
|
89402
|
89427
|
89428
|
89429
|
89430
|
89431
|
89432
|
89433
|
89434
|
89435
|
89436
|
89437
|
89438
|
89440
|
89441
|
89442
|
89443
|
89444
|
89445
|
89446
|
89447
|
89448
|
89449
|
89450
|
89451
|
89628
|
89629
|
89630
|
89631
|
89632
|
89633
|
89634
|
89635
|
89636
|
89637
|
89638
|
90501
|
91082
|
91083
|
91084
|
91085
|
91086
|
91087
|
91088
|
91089
|
91090
|
91091
|
91092
|
91093
|
91094