Bug 13766: Follow-up - use index_exists()
authorKatrin Fischer <katrin.fischer.83@web.de>
Mon, 4 Sep 2017 20:36:38 +0000 (20:36 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 9 Oct 2017 19:02:54 +0000 (16:02 -0300)
Changes check for existing index to use index_exists.
Also checks deletedbiblioitems for an existing ean index
and drops it if one is found.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
installer/data/mysql/atomicupdate/bug_13766_fix_ean.perl

index bfd7dd1..21d1fc1 100644 (file)
@@ -1,11 +1,12 @@
 $DBversion = "XXX";
 if(CheckVersion($DBversion)) {
     # Drop index that might exist because of bug 5337
-    my $temp = $dbh->selectall_arrayref(q{
-        SHOW INDEXES FROM biblioitems WHERE key_name = 'ean' });
-    if( @$temp > 0 ) {
+    if( index_exists('biblioitems', 'ean')) {
         $dbh->do(q{ ALTER TABLE biblioitems DROP INDEX ean });
     }
+    if( index_exists('deletedbiblioitems', 'ean')) {
+        $dbh->do(q{ ALTER TABLE deletedbiblioitems DROP INDEX ean });
+    }
 
     # Change data type of column
     $dbh->do(q{ ALTER TABLE biblioitems MODIFY COLUMN ean MEDIUMTEXT default NULL });