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

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

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

  TABLE_NAME = :audit_events
  COLUMN_NAMES = [:entity_id, :entity_type, :created_at, :id]
  INDEX_NAME = 'index_audit_events_on_entity_id_and_entity_type_and_created_at'

  disable_ddl_transaction!

  def up
    add_concurrent_partitioned_index(TABLE_NAME, COLUMN_NAMES, name: INDEX_NAME)
  end

  def down
    remove_concurrent_partitioned_index_by_name(TABLE_NAME, INDEX_NAME)
  end
end