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

class AddMetricsIndexToAuthenticationEvents < Gitlab::Database::Migration[2.0]
  INDEX_NAME = 'index_successful_authentication_events_for_metrics'
  disable_ddl_transaction!

  def up
    add_concurrent_index :authentication_events,
      %i[user_id provider created_at],
      where: "result = 1",
      name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :authentication_events, INDEX_NAME
  end
end