diff options
Diffstat (limited to 'db/post_migrate/20220825142324_replace_issues_authorization_index.rb')
-rw-r--r-- | db/post_migrate/20220825142324_replace_issues_authorization_index.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db/post_migrate/20220825142324_replace_issues_authorization_index.rb b/db/post_migrate/20220825142324_replace_issues_authorization_index.rb new file mode 100644 index 00000000000..b033cb22490 --- /dev/null +++ b/db/post_migrate/20220825142324_replace_issues_authorization_index.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class ReplaceIssuesAuthorizationIndex < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'idx_open_issues_on_project_and_confidential_and_author_and_id' + OLD_INDEX_NAME = 'idx_open_issues_on_project_id_and_confidential' + + def up + add_concurrent_index :issues, [:project_id, :confidential, :author_id, :id], name: INDEX_NAME, where: 'state_id = 1' + remove_concurrent_index_by_name :issues, OLD_INDEX_NAME + end + + def down + add_concurrent_index :issues, [:project_id, :confidential], name: OLD_INDEX_NAME, where: 'state_id = 1' + remove_concurrent_index_by_name :issues, INDEX_NAME + end +end |