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

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

class AddForeignKeyForCiPipelineMessagesPipelineIdBigint < Gitlab::Database::Migration[2.1]
  TABLE_NAME = :ci_pipeline_messages
  REFERENCING_TABLE_NAME = :ci_pipelines
  COLUMN_NAME = :pipeline_id_convert_to_bigint

  disable_ddl_transaction!

  def up
    add_concurrent_foreign_key(
      TABLE_NAME, REFERENCING_TABLE_NAME,
      column: COLUMN_NAME, on_delete: :cascade, validate: false, reverse_lock_order: true
    )
  end

  def down
    remove_foreign_key_if_exists TABLE_NAME, column: COLUMN_NAME
  end
end