Commit 2559a9d1 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'update-users-on-public-email-index' into 'master'

Change condition of users on public email index

See merge request gitlab-org/gitlab!74895
parents aab5fd7b 06d47638
# frozen_string_literal: true
class ChangeIndexUsersOnPublicEmail < Gitlab::Database::Migration[1.0]
INDEX_NAME = 'index_users_on_public_email'
INDEX_EXCLUDING_NULL_NAME = 'index_users_on_public_email_excluding_null_and_empty'
disable_ddl_transaction!
def up
index_condition = "public_email != '' AND public_email IS NOT NULL"
add_concurrent_index :users, [:public_email], where: index_condition, name: INDEX_EXCLUDING_NULL_NAME
remove_concurrent_index_by_name :users, INDEX_NAME
end
def down
index_condition = "public_email != ''"
add_concurrent_index :users, [:public_email], where: index_condition, name: INDEX_NAME
remove_concurrent_index_by_name :users, INDEX_EXCLUDING_NULL_NAME
end
end
4eacad00017890c71f3354d80061fae7af40499256475cdf035bdf41b916e5f3
\ No newline at end of file
...@@ -27534,7 +27534,7 @@ CREATE INDEX index_users_on_name ON users USING btree (name); ...@@ -27534,7 +27534,7 @@ CREATE INDEX index_users_on_name ON users USING btree (name);
CREATE INDEX index_users_on_name_trigram ON users USING gin (name gin_trgm_ops); CREATE INDEX index_users_on_name_trigram ON users USING gin (name gin_trgm_ops);
CREATE INDEX index_users_on_public_email ON users USING btree (public_email) WHERE ((public_email)::text <> ''::text); CREATE INDEX index_users_on_public_email_excluding_null_and_empty ON users USING btree (public_email) WHERE (((public_email)::text <> ''::text) AND (public_email IS NOT NULL));
CREATE INDEX index_users_on_require_two_factor_authentication_from_group ON users USING btree (require_two_factor_authentication_from_group) WHERE (require_two_factor_authentication_from_group = true); CREATE INDEX index_users_on_require_two_factor_authentication_from_group ON users USING btree (require_two_factor_authentication_from_group) WHERE (require_two_factor_authentication_from_group = true);
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