summaryrefslogtreecommitdiff
path: root/db/post_migrate/20230104222514_add_foreign_key_to_builds_metadata.rb
blob: b9c78e4eeb9d76ee3a25f45885d451b0ca3f8bb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

class AddForeignKeyToBuildsMetadata < Gitlab::Database::Migration[2.1]
  include Gitlab::Database::PartitioningMigrationHelpers

  disable_ddl_transaction!

  def up
    add_concurrent_partitioned_foreign_key :p_ci_builds_metadata,
                                           :ci_runner_machines,
                                           column: :runner_machine_id,
                                           on_delete: :nullify
  end

  def down
    remove_foreign_key_if_exists :p_ci_builds_metadata, column: :runner_machine_id
  end
end