From 3484fd3291cdbb6de4bdc69c879df3411e800412 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Wed, 24 Apr 2019 21:55:34 +0000 Subject: [PATCH] Bug 10300: (QA follow-up) Make database update idempotent Signed-off-by: Josef Moravec --- installer/data/mysql/atomicupdate/bug_10300.perl | 12 ++++++++++++ installer/data/mysql/atomicupdate/bug_10300.sql | 3 --- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_10300.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_10300.sql diff --git a/installer/data/mysql/atomicupdate/bug_10300.perl b/installer/data/mysql/atomicupdate/bug_10300.perl new file mode 100644 index 0000000..ffa97e0 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_10300.perl @@ -0,0 +1,12 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do( q{ + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) + SELECT 'IndependentBranchesTransfers', value, NULL, 'Allow non-superlibrarians to transfer items between libraries','YesNo' + FROM systempreferences WHERE variable = 'IndependentBranches' + }); + + # Always end with this (adjust the bug info) + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 10300 - Allow transferring of items to be have separate IndependentBranches syspref)\n"; +} diff --git a/installer/data/mysql/atomicupdate/bug_10300.sql b/installer/data/mysql/atomicupdate/bug_10300.sql deleted file mode 100644 index 1bcf5d9..0000000 --- a/installer/data/mysql/atomicupdate/bug_10300.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) -SELECT 'IndependentBranchesTransfers', value, NULL, 'Allow non-superlibrarians to transfer items between libraries','YesNo' -FROM systempreferences WHERE variable = 'IndependentBranches'; -- 2.1.4