From 19baad1b0b56e8f995d9c3ea8dae2d1d45985187 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 --- .../Bug15108-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 9a252cf..4cd702c 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.7.4