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

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

class AddForeignKeyForLatestPipelineIdToCiPipelines < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  disable_ddl_transaction!

  def up
    add_concurrent_foreign_key :vulnerability_statistics, :ci_pipelines, column: :latest_pipeline_id, on_delete: :nullify
  end

  def down
    with_lock_retries do
      remove_foreign_key_if_exists :vulnerability_statistics, :ci_pipelines
    end
  end
end