From 50f18574dbe16c636491c82b3546a12f21bdff70 Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Thu, 12 Nov 2020 13:38:49 +0000 Subject: [PATCH] Bug 24083: (QA follow-up) Fix DB upgrade This commit makes the addition of the 'unseen_renewals_allowed' circulation rule idempotent, as highlighted by Jonathan in comment #140 --- installer/data/mysql/updatedatabase.pl | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 2133c7d2fb..3bbfc677d2 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -23388,10 +23388,19 @@ if( CheckVersion( $DBversion ) ) { $DBversion = '20.06.00.069'; if( CheckVersion( $DBversion ) ) { - $dbh->do( q| - INSERT IGNORE INTO circulation_rules (rule_name, rule_value) - VALUES ('unseen_renewals_allowed', '') - | ); +# my ($count) = $dbh->selectrow_array( +# q| +# SELECT COUNT(*) +# FROM circulation_rules +# WHERE rule_name = 'unseen_renewals_allowed' +# | +# ); +# if ($count == 0) { + $dbh->do( q| + INSERT INTO circulation_rules (rule_name, rule_value) + VALUES ('unseen_renewals_allowed', '') + | ); +# } if( !column_exists( 'issues', 'unseen_renewals' ) ) { $dbh->do( q| ALTER TABLE issues ADD unseen_renewals TINYINT(4) DEFAULT 0 NOT NULL AFTER renewals | ); -- 2.20.1