diff options
-rw-r--r-- | changelogs/unreleased/62685-add-index-invite-email-to-members.yml | 5 | ||||
-rw-r--r-- | db/migrate/20190610142825_add_index_to_members_invite_email.rb | 21 | ||||
-rw-r--r-- | db/schema.rb | 1 |
3 files changed, 27 insertions, 0 deletions
diff --git a/changelogs/unreleased/62685-add-index-invite-email-to-members.yml b/changelogs/unreleased/62685-add-index-invite-email-to-members.yml new file mode 100644 index 00000000000..80bb05e1709 --- /dev/null +++ b/changelogs/unreleased/62685-add-index-invite-email-to-members.yml @@ -0,0 +1,5 @@ +--- +title: Add index on invite_email for members +merge_request: 29768 +author: +type: performance diff --git a/db/migrate/20190610142825_add_index_to_members_invite_email.rb b/db/migrate/20190610142825_add_index_to_members_invite_email.rb new file mode 100644 index 00000000000..58157cc5313 --- /dev/null +++ b/db/migrate/20190610142825_add_index_to_members_invite_email.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddIndexToMembersInviteEmail < ActiveRecord::Migration[5.1] + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :members, [:invite_email] + end + + def down + remove_concurrent_index :members, [:invite_email] + end +end diff --git a/db/schema.rb b/db/schema.rb index c6186c52699..6098ebc2a78 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1848,6 +1848,7 @@ ActiveRecord::Schema.define(version: 20190613030606) do t.boolean "ldap", default: false, null: false t.boolean "override", default: false, null: false t.index ["access_level"], name: "index_members_on_access_level", using: :btree + t.index ["invite_email"], name: "index_members_on_invite_email", using: :btree t.index ["invite_token"], name: "index_members_on_invite_token", unique: true, using: :btree t.index ["requested_at"], name: "index_members_on_requested_at", using: :btree t.index ["source_id", "source_type"], name: "index_members_on_source_id_and_source_type", using: :btree |