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>
$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 });