diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-26 15:07:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-26 15:07:29 +0300 |
commit | 597d5ed08988cb00681eaf252d04ebae4bd24731 (patch) | |
tree | fa6c90ecda00858be51b790dad9e4d9098d29fdb /db | |
parent | e2cf652edb5e9d9fa9a081952070074c07bf651e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20230707003301_add_expiry_notified_at_to_member.rb | 20 | ||||
-rw-r--r-- | db/post_migrate/20230714015909_add_index_for_member_expiring_query.rb | 18 | ||||
-rw-r--r-- | db/schema_migrations/20230707003301 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20230714015909 | 1 | ||||
-rw-r--r-- | db/structure.sql | 3 |
5 files changed, 43 insertions, 0 deletions
diff --git a/db/migrate/20230707003301_add_expiry_notified_at_to_member.rb b/db/migrate/20230707003301_add_expiry_notified_at_to_member.rb new file mode 100644 index 00000000000..e890325e5fa --- /dev/null +++ b/db/migrate/20230707003301_add_expiry_notified_at_to_member.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddExpiryNotifiedAtToMember < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE_NAME = 'members' + COLUMN_NAME = 'expiry_notified_at' + + def up + with_lock_retries do + add_column(TABLE_NAME, COLUMN_NAME, :datetime_with_timezone) + end + end + + def down + with_lock_retries do + remove_column TABLE_NAME, COLUMN_NAME + end + end +end diff --git a/db/post_migrate/20230714015909_add_index_for_member_expiring_query.rb b/db/post_migrate/20230714015909_add_index_for_member_expiring_query.rb new file mode 100644 index 00000000000..4d98d4792af --- /dev/null +++ b/db/post_migrate/20230714015909_add_index_for_member_expiring_query.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexForMemberExpiringQuery < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_members_on_expiring_at_access_level_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :members, + [:expires_at, :access_level, :id], + where: 'requested_at IS NULL AND expiry_notified_at IS NULL', + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :members, INDEX_NAME + end +end diff --git a/db/schema_migrations/20230707003301 b/db/schema_migrations/20230707003301 new file mode 100644 index 00000000000..b1d5d84ee1b --- /dev/null +++ b/db/schema_migrations/20230707003301 @@ -0,0 +1 @@ +dac0b6b1f86685bd19aed528c75197adfee06154ea68efdb854f4b17deb973fa
\ No newline at end of file diff --git a/db/schema_migrations/20230714015909 b/db/schema_migrations/20230714015909 new file mode 100644 index 00000000000..c5362b4a82d --- /dev/null +++ b/db/schema_migrations/20230714015909 @@ -0,0 +1 @@ +54f82e196c756ca60c4d7300ef1987a6b1ca50d4ef87bf89bb62eb577164365c
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index d1f21674c21..18e82de6a74 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -18018,6 +18018,7 @@ CREATE TABLE members ( invite_email_success boolean DEFAULT true NOT NULL, member_namespace_id bigint, member_role_id bigint, + expiry_notified_at timestamp with time zone, CONSTRAINT check_508774aac0 CHECK ((member_namespace_id IS NOT NULL)) ); @@ -31872,6 +31873,8 @@ CREATE INDEX index_members_on_access_level ON members USING btree (access_level) CREATE INDEX index_members_on_expires_at ON members USING btree (expires_at); +CREATE INDEX index_members_on_expiring_at_access_level_id ON members USING btree (expires_at, access_level, id) WHERE ((requested_at IS NULL) AND (expiry_notified_at IS NULL)); + CREATE INDEX index_members_on_invite_email ON members USING btree (invite_email); CREATE UNIQUE INDEX index_members_on_invite_token ON members USING btree (invite_token); |