diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-25 21:14:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-25 21:14:13 +0300 |
commit | 1c635e68ea6fb392244f0d9f8c9dd2c7bd1c95e6 (patch) | |
tree | 052cfeba83f0db195c3861cd3a0173df30bb8a01 /db | |
parent | d03aeb1110374d140a42622716597ccfa8e4ba57 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20211124132705_change_index_users_on_public_email.rb | 22 | ||||
-rw-r--r-- | db/schema_migrations/20211124132705 | 1 | ||||
-rw-r--r-- | db/structure.sql | 2 |
3 files changed, 24 insertions, 1 deletions
diff --git a/db/post_migrate/20211124132705_change_index_users_on_public_email.rb b/db/post_migrate/20211124132705_change_index_users_on_public_email.rb new file mode 100644 index 00000000000..6e74a325033 --- /dev/null +++ b/db/post_migrate/20211124132705_change_index_users_on_public_email.rb @@ -0,0 +1,22 @@ +# 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 diff --git a/db/schema_migrations/20211124132705 b/db/schema_migrations/20211124132705 new file mode 100644 index 00000000000..12e3f08365b --- /dev/null +++ b/db/schema_migrations/20211124132705 @@ -0,0 +1 @@ +4eacad00017890c71f3354d80061fae7af40499256475cdf035bdf41b916e5f3
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 32baa151239..9a57719ec24 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -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_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); |