PERF: add index on user auth tokens (for user lookups)

This speeds up user destroy cause we cascade looking up all the tokens
for a user
This commit is contained in:
Sam Saffron 2019-04-26 22:38:54 +10:00
parent 378fe1c1cf
commit b8c65cc6cf
2 changed files with 6 additions and 0 deletions

View File

@ -242,4 +242,5 @@ end
#
# index_user_auth_tokens_on_auth_token (auth_token) UNIQUE
# index_user_auth_tokens_on_prev_auth_token (prev_auth_token) UNIQUE
# index_user_auth_tokens_on_user_id (user_id)
#

View File

@ -0,0 +1,5 @@
class AddIndexOnUserAuthTokenUser < ActiveRecord::Migration[5.2]
def change
add_index :user_auth_tokens, [:user_id]
end
end