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

class AddResultIndexToAuthenticationEvents < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  INDEX_NAME = 'index_authentication_events_on_provider_user_id_created_at'

  disable_ddl_transaction!

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

  def down
    remove_concurrent_index_by_name :authentication_events, INDEX_NAME
  end
end