Skip to content

Fix error on deleting exclusions and limit creating exclusions

Jerry Seto requested to merge 454372-fix-delete-error into master

What does this MR do and why?

This change fixes: !152601 (comment 1900459589)

It also replaces the multiple delete statements with a single delete by id.

Also includes a change to address: !151943 (comment 1898582594)

Query plans

Before:

DELETE FROM "integrations" WHERE "integrations"."id" = 2597 
DELETE FROM "integrations" WHERE "integrations"."id" = 2599 

After: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/28197/commands/87878

DELETE FROM "integrations"
WHERE "integrations"."type_new" = 'Integrations::BeyondIdentity'
    AND "integrations"."id" IN (2597, 2599)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. Create some exclusions (e.g in rails console: FactoryBot.create(:beyond_identity_integration, project_id: 2, active: false, inherit_from_id: nil, instance: false)
  2. Delete the exclusions through the mutation endpoint
mutation integrationExclusionDelete($input: IntegrationExclusionDeleteInput!) {
  integrationExclusionDelete(input: $input) {
    exclusions {
      project {
        id
        name
      }
    }
    errors
  }
}
# Example variables
# {
#   "input": {
#     "projectIds": ["gid://gitlab/Project/2"],
#     "integrationName": "BEYOND_IDENTITY"
#   }
# }

Related to #454372

Edited by Jerry Seto

Merge request reports