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

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

  disable_ddl_transaction!

  INDEX_NAME = 'index_web_hook_logs_on_web_hook_id_and_created_at'

  def up
    add_concurrent_partitioned_index(
      :web_hook_logs,
      [:web_hook_id, :created_at],
      name: INDEX_NAME
    )
  end

  def down
    remove_concurrent_partitioned_index_by_name :web_hook_logs, INDEX_NAME
  end
end