From 9072a4dba0ead2feeae740301a3cb2c0c299ad22 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 8 Jan 2014 07:58:14 -0500 Subject: [PATCH] Bug 9303 [QA Followup] - Set AUTO_INCREMENT value for issues.issue_id --- installer/data/mysql/updatedatabase.pl | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 99d112e..810a512 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -37,6 +37,7 @@ use Getopt::Long; use C4::Context; use C4::Installer; use C4::Dates; +use Koha::Database; use MARC::Record; use MARC::File::XML ( BinaryEncoding => 'utf8' ); @@ -8219,6 +8220,16 @@ if(CheckVersion($DBversion)) { $dbh->do(qq{ 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 + }); + print "Upgrade to $DBversion done (Bug 9303 - relative's checkouts in the opac)\n"; SetVersion($DBversion); } -- 1.7.2.5