Add an index to users.old_username (#13102)

We have one for username and for old_old_username, but not the one in
between.
This commit is contained in:
Jamie Gaskins 2021-03-23 15:53:45 -04:00 committed by GitHub
parent 7c45df1d81
commit ec39e0c000
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -0,0 +1,8 @@
class AddIndexesToOldUsernames < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
def change
# Used in StoriesController#show and #index
add_index :users, :old_username, algorithm: :concurrently
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_03_12_191925) do
ActiveRecord::Schema.define(version: 2021_03_23_190443) do
# These are extensions that must be enabled in order to support this database
enable_extension "citext"
@ -1362,6 +1362,7 @@ ActiveRecord::Schema.define(version: 2021_03_12_191925) do
t.index ["invited_by_id"], name: "index_users_on_invited_by_id"
t.index ["invited_by_type", "invited_by_id"], name: "index_users_on_invited_by_type_and_invited_by_id"
t.index ["old_old_username"], name: "index_users_on_old_old_username"
t.index ["old_username"], name: "index_users_on_old_username"
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
t.index ["twitter_username"], name: "index_users_on_twitter_username", unique: true
t.index ["username"], name: "index_users_on_username", unique: true