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

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

class AddAgentGroupAuthorizationsForeignKeys < ActiveRecord::Migration[6.1]
  include Gitlab::Database::MigrationHelpers

  disable_ddl_transaction!

  def up
    add_concurrent_foreign_key :agent_group_authorizations, :namespaces, column: :group_id
    add_concurrent_foreign_key :agent_group_authorizations, :cluster_agents, column: :agent_id
  end

  def down
    with_lock_retries do
      remove_foreign_key_if_exists :agent_group_authorizations, column: :group_id
    end

    with_lock_retries do
      remove_foreign_key_if_exists :agent_group_authorizations, column: :agent_id
    end
  end
end