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

20210913010432_add_agent_project_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: 545fc1259500e69f67e479123c464b2e78b744f7 (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 AddAgentProjectAuthorizationsForeignKeys < Gitlab::Database::Migration[1.0]
  disable_ddl_transaction!

  def up
    add_concurrent_foreign_key :agent_project_authorizations, :projects, column: :project_id
    add_concurrent_foreign_key :agent_project_authorizations, :cluster_agents, column: :agent_id
  end

  def down
    with_lock_retries do
      remove_foreign_key_if_exists :agent_project_authorizations, column: :project_id
    end

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