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

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

class AddClusterIdIndexFkToDeployments < ActiveRecord::Migration[5.1]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index :deployments, :cluster_id

    add_concurrent_foreign_key :deployments, :clusters, column: :cluster_id, on_delete: :nullify
  end

  def down
    remove_foreign_key :deployments, :clusters

    remove_concurrent_index :deployments, :cluster_id
  end
end