From aabb3350cad7873b4d83240f7a07ab410fb3d9f2 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 6 Jul 2018 14:25:20 +0000 Subject: [PATCH] Bug 12395: (RM follow-up) Make updatedatabase statements idempotent Signed-off-by: Nick Clemens --- installer/data/mysql/updatedatabase.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 20ae89dc80..e43f2a8fba 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -16129,9 +16129,9 @@ if( CheckVersion( $DBversion ) ) { $DBversion = '18.06.00.005'; if( CheckVersion( $DBversion ) ) { - $dbh->do( "ALTER TABLE aqorders ADD COLUMN created_by int(11) NULL DEFAULT NULL AFTER quantityreceived;" ); - $dbh->do( "ALTER TABLE aqorders ADD CONSTRAINT aqorders_created_by FOREIGN KEY (created_by) REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE;" ); - $dbh->do( "UPDATE aqorders, aqbasket SET aqorders.created_by = aqbasket.authorisedby WHERE aqorders.basketno = aqbasket.basketno;" ); + $dbh->do( "ALTER IGNORE TABLE aqorders ADD COLUMN created_by int(11) NULL DEFAULT NULL AFTER quantityreceived;" ); + $dbh->do( "ALTER IGNORE TABLE aqorders ADD CONSTRAINT aqorders_created_by FOREIGN KEY (created_by) REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE;" ); + $dbh->do( "UPDATE aqorders, aqbasket SET aqorders.created_by = aqbasket.authorisedby WHERE aqorders.basketno = aqbasket.basketno AND aqorders.created_by IS NULL;" ); SetVersion( $DBversion ); print "Upgrade to $DBversion done (Bug 12395 - Save order line's creator)\n"; } -- 2.39.5