PERF: Add index on email_tokens.token_hash

This commit is contained in:
Dan Ungureanu 2021-12-06 19:17:32 +02:00 committed by Alan Guo Xiang Tan
parent 4e67297a7c
commit 9a6ec1d0c6
2 changed files with 10 additions and 2 deletions

View File

@ -122,5 +122,6 @@ end
# Indexes
#
# index_email_tokens_on_token (token) UNIQUE
# index_email_tokens_on_token_hash (token_hash) UNIQUE
# index_email_tokens_on_user_id (user_id)
#

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
class CreateIndexOnEmailTokensTokenHash < ActiveRecord::Migration[6.1]
def change
add_index :email_tokens, :token_hash, unique: true
end
end