Bug 13766: Follow-up - use index_exists()

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>
This commit is contained in:
Katrin Fischer 2017-09-04 20:36:38 +00:00 committed by Jonathan Druart
parent c367705d9d
commit 0152e95c97

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