Skip to content

Remove orphaned approval rules for imported project/merge request

What does this MR do and why?

This MR removes orphaned approval rules for imported project/merge requests: Approval Rules of report type (scan_finding and license_scanning) and with orchestration_security_policy_project_id as nil.

  • ~1240 Approval Project Rules to be deleted.
  • ~98k Approval Merge Request Rules to be deleted.

Queries

SELECT "approval_project_rules".* FROM "approval_project_rules" WHERE "approval_project_rules"."report_type" IN (2, 4) AND "approval_project_rules"."security_orchestration_policy_configuration_id" IS NULL

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/20623/commands/67667

SELECT "approval_merge_request_rules".* FROM "approval_merge_request_rules" WHERE "approval_merge_request_rules"."report_type" IN (2, 4) AND "approval_merge_request_rules"."security_orchestration_policy_configuration_id" IS NULL
Before adding an index in !127426 (merged):

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/20623/commands/67668

After adding an index in !127426 (merged):

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/21309/commands/69404

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #415925 (closed)

Edited by Alan (Maciej) Paruszewski

Merge request reports