From 1c83bd06387a42554f89a21820297970d1377fb4 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 11 Oct 2022 09:08:56 -0300 Subject: [PATCH] Bug 31673: (QA follow-up) Check if FK exists before attempt to remove Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/db_revs/220600020.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/db_revs/220600020.pl b/installer/data/mysql/db_revs/220600020.pl index b023204410..e8999a10de 100755 --- a/installer/data/mysql/db_revs/220600020.pl +++ b/installer/data/mysql/db_revs/220600020.pl @@ -32,9 +32,12 @@ return { }); # Remove FOREIGN KEY CONSTRAINT - $dbh->do(q{ - ALTER TABLE reserves DROP FOREIGN KEY reserves_ibfk_4; - }); + if ( foreign_key_exists( 'reserves', 'reserves_ibfk_4' ) ) { + $dbh->do(q{ + ALTER TABLE reserves DROP FOREIGN KEY reserves_ibfk_4; + }); + } + # Set the NOT NULL configuration $dbh->do(q{ ALTER TABLE reserves -- 2.39.5