1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# frozen_string_literal: true
class AddFksToAgentUserAccessAuthorizations < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
def up
add_concurrent_foreign_key :agent_user_access_project_authorizations, :projects,
column: :project_id, on_delete: :cascade
add_concurrent_foreign_key :agent_user_access_project_authorizations, :cluster_agents,
column: :agent_id, on_delete: :cascade
add_concurrent_foreign_key :agent_user_access_group_authorizations, :namespaces,
column: :group_id, on_delete: :cascade
add_concurrent_foreign_key :agent_user_access_group_authorizations, :cluster_agents,
column: :agent_id, on_delete: :cascade
end
def down
with_lock_retries do
remove_foreign_key_if_exists :agent_user_access_project_authorizations, column: :project_id
end
with_lock_retries do
remove_foreign_key_if_exists :agent_user_access_project_authorizations, column: :agent_id
end
with_lock_retries do
remove_foreign_key_if_exists :agent_user_access_group_authorizations, column: :group_id
end
with_lock_retries do
remove_foreign_key_if_exists :agent_user_access_group_authorizations, column: :agent_id
end
end
end
|