Commit ae677b83 authored by Stan Hu's avatar Stan Hu

Merge branch 'sh-add-index-unlock-token' into 'master'

Add index on users.unlock_token

See merge request gitlab-org/gitlab!27628
parents 354366ff 24ec3d2c
---
title: Add index on users.unlock_token
merge_request: 276298
author:
type: performance
# frozen_string_literal: true
class AddIndexOnUsersUnlockToken < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_users_on_unlock_token'
disable_ddl_transaction!
def up
add_concurrent_index :users, :unlock_token, unique: true, name: INDEX_NAME
end
def down
remove_concurrent_index :users, :unlock_token, unique: true, name: INDEX_NAME
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_03_18_152134) do
ActiveRecord::Schema.define(version: 2020_03_19_203901) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
......@@ -4441,6 +4441,7 @@ ActiveRecord::Schema.define(version: 2020_03_18_152134) do
t.index ["state"], name: "index_users_on_state"
t.index ["static_object_token"], name: "index_users_on_static_object_token", unique: true
t.index ["unconfirmed_email"], name: "index_users_on_unconfirmed_email", where: "(unconfirmed_email IS NOT NULL)"
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
t.index ["user_type"], name: "index_users_on_user_type"
t.index ["username"], name: "index_users_on_username"
t.index ["username"], name: "index_users_on_username_trigram", opclass: :gin_trgm_ops, using: :gin
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment