From 12fa274ba755e672accf6982fef56d27005bb4e8 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 (cherry picked from commit 1c83bd06387a42554f89a21820297970d1377fb4) Signed-off-by: Lucas Gass (cherry picked from commit 4c8ffab5636a46ace0091913c70bf01df6b1dd12) Signed-off-by: Arthur Suzuki --- installer/data/mysql/db_revs/211112000.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/db_revs/211112000.pl b/installer/data/mysql/db_revs/211112000.pl index b023204410..e8999a10de 100644 --- a/installer/data/mysql/db_revs/211112000.pl +++ b/installer/data/mysql/db_revs/211112000.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