diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2019-05-07 10:38:43 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-05-07 10:38:43 +0300 |
commit | 24eff5e08332a0bf301a85630be171332174cc1f (patch) | |
tree | 16f89210b0be32d13c500e1afb96ba2488d90018 /lib | |
parent | bd73925b858cbb7229b3d335da0e5d0023f57caf (diff) |
Add remove_foreign_key_if_exists
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/database/migration_helpers.rb | 6 |
1 files changed, 6 insertions, 0 deletions
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 |