From b455bb6e21a6dff80e5f9028cd59ccc60966eeb7 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 17 Apr 2015 11:00:52 -0400 Subject: [PATCH] Bug 13790: ([QA Followup) Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/updatedatabase.pl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 59d208312f..991b7b05f8 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -58,6 +58,8 @@ my ( $prefitem, # preference item in systempreferences table ); +my $schema = Koha::Database->new()->schema(); + my $silent; GetOptions( 's' =>\$silent @@ -10179,14 +10181,13 @@ if(CheckVersion($DBversion)) { UPDATE issues SET issue_id = issue_id + ( SELECT COUNT(*) FROM old_issues ) ORDER BY issue_id DESC }); - my $schema = Koha::Database->new()->schema(); my $max_issue_id = $schema->resultset('Issue')->get_column('issue_id')->max(); - $max_issue_id ||= $schema->resultset('OldIssue')->get_column('issue_id')->max(); - $max_issue_id ||= 0; - $max_issue_id++; - $dbh->do(qq{ - ALTER TABLE issues AUTO_INCREMENT = $max_issue_id} - ); + if ($max_issue_id) { + $max_issue_id++; + $dbh->do(qq{ + ALTER TABLE issues AUTO_INCREMENT = $max_issue_id + }); + } print "Upgrade to $DBversion done (Bug 13790 - Add unique id issue_id to issues and oldissues tables)\n"; SetVersion($DBversion); -- 2.39.5