From 24eff5e08332a0bf301a85630be171332174cc1f Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Tue, 7 May 2019 15:38:43 +0800 Subject: Add remove_foreign_key_if_exists --- lib/gitlab/database/migration_helpers.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 7f5eb1188fc..cc61bb7fa02 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -905,6 +905,12 @@ module Gitlab end end + def remove_foreign_key_if_exists(*args) + if foreign_key_exists?(*args) + remove_foreign_key(*args) + end + end + def remove_foreign_key_without_error(*args) remove_foreign_key(*args) rescue ArgumentError -- cgit v1.2.1