summaryrefslogtreecommitdiff
path: root/db/post_migrate/20210413130011_add_partitioned_web_hook_log_fk.rb
blob: 6453993bd5126f3318bd7a6ca4dc7ef4c3e8b253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

class AddPartitionedWebHookLogFk < ActiveRecord::Migration[6.0]
  include Gitlab::Database::PartitioningMigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_partitioned_foreign_key :web_hook_logs_part_0c5294f417,
      :web_hooks,
      column: :web_hook_id,
      on_delete: :cascade
  end

  def down
    with_lock_retries do
      remove_foreign_key_if_exists :web_hook_logs_part_0c5294f417, column: :web_hook_id
    end
  end
end