Cleanup attention request reviewer state
What does this MR do and why?
This MR cleans up reviewer states that were set to attention_requested
which is no longer a valid state after the feature removal. Since this state is requesting attention from the reviewer, it seems to make sense to reset it to unreviewed
. No visual changes is anticipated from this change for end users. The only place we query this value is !95446 (diffs) and the return value would still be the same after this MR as it only checks if the state is reviewed
.
Related to #371941 (closed) and &8650 (closed)
Database
Up
# rake db:migrate
main: == 20220905090300 AddTmpIndexMergeRequestReviewersAttentionRequestState: migrating
main: -- transaction_open?()
main: -> 0.0000s
main: -- index_exists?(:merge_request_reviewers, [:id], {:where=>"state = 2", :name=>"tmp_index_merge_request_reviewers_on_attention_requested_state", :algorithm=>:concurrently})
main: -> 0.0331s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0004s
main: -- add_index(:merge_request_reviewers, [:id], {:where=>"state = 2", :name=>"tmp_index_merge_request_reviewers_on_attention_requested_state", :algorithm=>:concurrently})
main: -> 0.0056s
main: -- execute("RESET statement_timeout")
main: -> 0.0005s
main: == 20220905090300 AddTmpIndexMergeRequestReviewersAttentionRequestState: migrated (0.0545s)
main: == 20220905090339 ResetAttentionRequestedMergeRequestsReviewersStateToUnreviewed: migrating
main: == 20220905090339 ResetAttentionRequestedMergeRequestsReviewersStateToUnreviewed: migrated (0.0062s)
ci: == 20220905090300 AddTmpIndexMergeRequestReviewersAttentionRequestState: migrating
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- index_exists?(:merge_request_reviewers, [:id], {:where=>"state = 2", :name=>"tmp_index_merge_request_reviewers_on_attention_requested_state", :algorithm=>:concurrently})
ci: -> 0.0059s
ci: -- execute("SET statement_timeout TO 0")
ci: -> 0.0003s
ci: -- add_index(:merge_request_reviewers, [:id], {:where=>"state = 2", :name=>"tmp_index_merge_request_reviewers_on_attention_requested_state", :algorithm=>:concurrently})
ci: -> 0.0076s
ci: -- execute("RESET statement_timeout")
ci: -> 0.0004s
ci: == 20220905090300 AddTmpIndexMergeRequestReviewersAttentionRequestState: migrated (0.0200s)
ci: == 20220905090339 ResetAttentionRequestedMergeRequestsReviewersStateToUnreviewed: migrating
ci: -- The migration is skipped since it modifies the schemas: [:gitlab_main].
ci: -- This database can only apply migrations in one of the following schemas: [:gitlab_ci, :gitlab_shared, :gitlab_internal].
ci: == 20220905090339 ResetAttentionRequestedMergeRequestsReviewersStateToUnreviewed: migrated (0.0001s)
Down
# rake db:migrate:down:main VERSION=20220905090300
main: == 20220905090300 AddTmpIndexMergeRequestReviewersAttentionRequestState: reverting
main: -- transaction_open?()
main: -> 0.0000s
main: -- indexes(:merge_request_reviewers)
main: -> 0.0192s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0015s
main: -- remove_index(:merge_request_reviewers, {:algorithm=>:concurrently, :name=>"tmp_index_merge_request_reviewers_on_attention_requested_state"})
main: -> 0.0066s
main: -- execute("RESET statement_timeout")
main: -> 0.0004s
main: == 20220905090300 AddTmpIndexMergeRequestReviewersAttentionRequestState: reverted (0.0441s)
# rake db:migrate:down:main VERSION=20220905090339
main: == 20220905090339 ResetAttentionRequestedMergeRequestsReviewersStateToUnreviewed: reverting
main: == 20220905090339 ResetAttentionRequestedMergeRequestsReviewersStateToUnreviewed: reverted (0.0006s)
# rake db:migrate:down:ci VERSION=20220905090300
ci: == 20220905090300 AddTmpIndexMergeRequestReviewersAttentionRequestState: reverting
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- indexes(:merge_request_reviewers)
ci: -> 0.0224s
ci: -- execute("SET statement_timeout TO 0")
ci: -> 0.0005s
ci: -- remove_index(:merge_request_reviewers, {:algorithm=>:concurrently, :name=>"tmp_index_merge_request_reviewers_on_attention_requested_state"})
ci: -> 0.0062s
ci: -- execute("RESET statement_timeout")
ci: -> 0.0009s
ci: == 20220905090300 AddTmpIndexMergeRequestReviewersAttentionRequestState: reverted (0.0441s)
# rake db:migrate:down:ci VERSION=20220905090339
ci: == 20220905090339 ResetAttentionRequestedMergeRequestsReviewersStateToUnreviewed: reverting
ci: -- The migration is skipped since it modifies the schemas: [:gitlab_main].
ci: -- This database can only apply migrations in one of the following schemas: [:gitlab_ci, :gitlab_shared, :gitlab_internal].
ci: == 20220905090339 ResetAttentionRequestedMergeRequestsReviewersStateToUnreviewed: reverted (0.0001s)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Sincheol (David) Kim