Bugzilla – Attachment 38736 Details for
Bug 14069
Follow-up 13790: Fix database update to drop PK on issues/old_issues first
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 14069: Drop existing primary key on items if exists
PASSED-QA-Bug-14069-Drop-existing-primary-key-on-i.patch (text/plain), 2.59 KB, created by
Kyle M Hall (khall)
on 2015-05-01 12:59:48 UTC
(
hide
)
Description:
[PASSED QA] Bug 14069: Drop existing primary key on items if exists
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-05-01 12:59:48 UTC
Size:
2.59 KB
patch
obsolete
>From 4ec4de746b3377111429b083d8d0f295b5eb17b8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 29 Apr 2015 10:15:50 +0200 >Subject: [PATCH] [PASSED QA] Bug 14069: Drop existing primary key on items if exists > >On old databases, the issues table has a primary key on itemnumber. >The DBrev 3.19.00.028 (Bug 13790 - Add unique id issue_id to issues and >oldissues tables) has to remove it before adding the new primary key > >Test plan: >1/ Make sure you have an old DB, or add primary key (issues.itemnumber)manually >on a DB created before 3.19.00.028. >2/ Execute the updatedatabase.pl script >3/ You should not get any error and the primary key on itemnumber should >have been removed and the new one created as expected. > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >No koha-qa errors > >Tested using a 3.4 db (3.0404000) >Interestingly, it gives a similar error on the same table but >on another (older $DBversion = "3.05.00.009";) update > >1) Pre-patch, 3.4 DB, updatedatabase from master, errors >(older) >DBD::mysql::db do failed: Multiple primary key defined at installer/data/mysql/updatedatabase.pl line 4435. >(13790) >DBD::mysql::db do failed: Multiple primary key defined at installer/data/mysql/updatedatabase.pl line 10166. >DBD::mysql::db do failed: Unknown column 'issue_id' in 'order clause' at installer/data/mysql/updatedatabase.pl line 10170. >DBD::mysql::st execute failed: Unknown column 'me.issue_id' in 'field list' at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1593. >DBIx::Class::ResultSetColumn::max(): Unknown column 'me.issue_id' in 'field list' at installer/data/mysql/updatedatabase.pl line 10174 > >2) Post-patch, same conditions >(only older) >DBD::mysql::db do failed: Multiple primary key defined at installer/data/mysql/updatedatabase.pl line 4435. > >There are other warnings, but nor related with keys. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > installer/data/mysql/updatedatabase.pl | 7 +++++++ > 1 files changed, 7 insertions(+), 0 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 128d8ad..9069f82 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -10155,6 +10155,13 @@ if ( CheckVersion($DBversion) ) { > > $DBversion = "3.19.00.028"; > if( CheckVersion($DBversion) ) { >+ eval { >+ local $dbh->{PrintError} = 0; >+ $dbh->do(q{ >+ ALTER TABLE issues DROP PRIMARY KEY >+ }); >+ }; >+ > $dbh->do(q{ > ALTER TABLE old_issues ADD issue_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST > }); >-- >1.7.2.5
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 14069
:
38644
|
38720
| 38736