Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20210922220104_add_issue_customer_relations_contacts_foreign_keys.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7be465ca31a9f81adbd21dac065eab1b6fe2cde5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

class AddIssueCustomerRelationsContactsForeignKeys < Gitlab::Database::Migration[1.0]
  disable_ddl_transaction!

  def up
    add_concurrent_foreign_key :issue_customer_relations_contacts, :issues, column: :issue_id
    add_concurrent_foreign_key :issue_customer_relations_contacts, :customer_relations_contacts, column: :contact_id
  end

  def down
    with_lock_retries do
      remove_foreign_key_if_exists :issue_customer_relations_contacts, column: :issue_id
    end

    with_lock_retries do
      remove_foreign_key_if_exists :issue_customer_relations_contacts, column: :contact_id
    end
  end
end