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

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

class CreateWorkspacesClusterAgentForeignKey < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  def up
    # NOTE: All workspace foreign key references are currently `on_delete: :cascade`, because we have no support or
    #       testing around null values. However, in the future we may want to switch these to nullify, especially
    #       once we start introducing logging, metrics, billing, etc. around workspaces.
    add_concurrent_foreign_key :workspaces, :cluster_agents, column: :cluster_agent_id, on_delete: :cascade
  end

  def down
    with_lock_retries do
      remove_foreign_key :workspaces, column: :cluster_agent_id
    end
  end
end