Bugzilla – Attachment 156878 Details for
Bug 34881
Database update for bug 28854 isn't fully idempotent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34881: [alternative patch] Improve idempotency of DBRev
Bug-34881-alternative-patch-Improve-idempotency-of.patch (text/plain), 3.02 KB, created by
David Nind
on 2023-10-11 20:13:43 UTC
(
hide
)
Description:
Bug 34881: [alternative patch] Improve idempotency of DBRev
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-10-11 20:13:43 UTC
Size:
3.02 KB
patch
obsolete
>From 04c4e511066cbc722270ef1ab986ea35077fae8b Mon Sep 17 00:00:00 2001 >From: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >Date: Wed, 11 Oct 2023 09:40:05 -0400 >Subject: [PATCH] Bug 34881: [alternative patch] Improve idempotency of DBRev > >Signed-off-by: David Nind <david@davidnind.com> >--- > installer/data/mysql/db_revs/220600015.pl | 46 +++++++++++++++++------ > 1 file changed, 34 insertions(+), 12 deletions(-) > >diff --git a/installer/data/mysql/db_revs/220600015.pl b/installer/data/mysql/db_revs/220600015.pl >index 89dc2d628b..9b12ba6204 100755 >--- a/installer/data/mysql/db_revs/220600015.pl >+++ b/installer/data/mysql/db_revs/220600015.pl >@@ -22,21 +22,43 @@ return { > > say $out "Added new table 'item_bundles'"; > >- my ($lost_val) = $dbh->selectrow_array( "SELECT MAX(CAST(authorised_value AS SIGNED)) FROM authorised_values WHERE category = 'LOST'", {} ); >- $lost_val++; >+ my ($lost_val) = $dbh->selectrow_array( >+ "SELECT CAST(authorised_value AS SIGNED) FROM authorised_values WHERE category = 'LOST' AND lib = 'Missing from bundle' LIMIT 1", >+ {} >+ ); > >- $dbh->do(qq{ >- INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('LOST',$lost_val,'Missing from bundle') >- }); >- say $out "Missing from bundle LOST AV added"; >+ if ( !$lost_val ) { > >- my ($nfl_val) = $dbh->selectrow_array( "SELECT MAX(CAST(authorised_value AS SIGNED)) FROM authorised_values WHERE category = 'NOT_LOAN'", {} ); >- $nfl_val++; >+ ($lost_val) = $dbh->selectrow_array( >+ "SELECT MAX(CAST(authorised_value AS SIGNED)) FROM authorised_values WHERE category = 'LOST'", {} ); >+ $lost_val++; > >- $dbh->do(qq{ >- INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('NOT_LOAN',$nfl_val,'Added to bundle') >- }); >- say $out "Added to bundle NOT_LOAN AV added"; >+ $dbh->do( >+ qq{) >+ INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('LOST',$lost_val,'Missing from bundle') >+ } >+ ); >+ say $out "Missing from bundle LOST AV added"; >+ } >+ >+ my ($nfl_val) = $dbh->selectrow_array( >+ "SELECT CAST(authorised_value AS SIGNED) FROM authorised_values WHERE category = 'NOT_LOAN' AND lib = 'Added to bundle' LIMIT 1", >+ {} >+ ); >+ >+ if ( !$nfl_val ) { >+ >+ ($nfl_val) = $dbh->selectrow_array( >+ "SELECT MAX(CAST(authorised_value AS SIGNED)) FROM authorised_values WHERE category = 'NOT_LOAN'", {} ); >+ $nfl_val++; >+ >+ $dbh->do( >+ qq{ >+ INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('NOT_LOAN',$nfl_val,'Added to bundle') >+ } >+ ); >+ say $out "Added to bundle NOT_LOAN AV added"; >+ } > > $dbh->do(qq{ > INSERT IGNORE INTO systempreferences( `variable`, `value`, `options`, `explanation`, `type` ) >-- >2.30.2
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 34881
:
156047
|
156823
|
156878
|
156978
|
156979