From 5fbd65513329eb8962d10221e0c60417b9cfe726 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 5 May 2017 11:38:31 -0300 Subject: [PATCH] Bug 15108: (QA followup) Fix atomic update file Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall --- ...ug15108-OAI-PMH_provider_improvements.perl | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/installer/data/mysql/atomicupdate/Bug15108-OAI-PMH_provider_improvements.perl b/installer/data/mysql/atomicupdate/Bug15108-OAI-PMH_provider_improvements.perl index 9a252cf5ce..4cd702c90d 100644 --- a/installer/data/mysql/atomicupdate/Bug15108-OAI-PMH_provider_improvements.perl +++ b/installer/data/mysql/atomicupdate/Bug15108-OAI-PMH_provider_improvements.perl @@ -1,11 +1,18 @@ -$DBversion = 'XXX'; # will be replaced by the RM +$DBversion = 'XXX'; if( CheckVersion( $DBversion ) ) { - $dbh->do("ALTER TABLE biblioitems ADD KEY `timestamp` (`timestamp`);"); - $dbh->do("ALTER TABLE deletedbiblioitems ADD KEY `timestamp` (`timestamp`);"); - $dbh->do("ALTER TABLE items ADD KEY `timestamp` (`timestamp`);"); - $dbh->do("ALTER TABLE deleteditems ADD KEY `timestamp` (`timestamp`);"); + if ( !index_exists( 'biblioitems', 'timestamp' ) ) { + $dbh->do("ALTER TABLE biblioitems ADD KEY `timestamp` (`timestamp`);"); + } + if ( !index_exists( 'deletedbiblioitems', 'timestamp' ) ) { + $dbh->do("ALTER TABLE deletedbiblioitems ADD KEY `timestamp` (`timestamp`);"); + } + if ( !index_exists( 'items', 'timestamp' ) ) { + $dbh->do("ALTER TABLE items ADD KEY `timestamp` (`timestamp`);"); + } + if ( !index_exists( 'deleteditems', 'timestamp' ) ) { + $dbh->do("ALTER TABLE deleteditems ADD KEY `timestamp` (`timestamp`);"); + } - # Always end with this (adjust the bug info) SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 15108 - OAI-PMH provider improvements)\n"; + print "Upgrade to $DBversion done (Bug 15108: OAI-PMH provider improvements)\n"; } -- 2.39.5