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

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

class RemoveCiPipelinesMergeTrainsPipelineIdFk < Gitlab::Database::Migration[1.0]
  disable_ddl_transaction!

  def up
    with_lock_retries do
      execute('LOCK ci_pipelines, merge_trains IN ACCESS EXCLUSIVE MODE')

      remove_foreign_key_if_exists(:merge_trains, :ci_pipelines, name: "fk_rails_f90820cb08")
    end
  end

  def down
    add_concurrent_foreign_key(:merge_trains, :ci_pipelines, name: "fk_rails_f90820cb08", column: :pipeline_id, target_column: :id, on_delete: :nullify)
  end
end