diff options
Diffstat (limited to 'db/migrate/20200916151442_add_result_index_to_authentication_events.rb')
-rw-r--r-- | db/migrate/20200916151442_add_result_index_to_authentication_events.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20200916151442_add_result_index_to_authentication_events.rb b/db/migrate/20200916151442_add_result_index_to_authentication_events.rb new file mode 100644 index 00000000000..13b0521038e --- /dev/null +++ b/db/migrate/20200916151442_add_result_index_to_authentication_events.rb @@ -0,0 +1,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 |