Add OrganizationDelete GraphQL mutation and expose state fields (#594313)
What does this MR do and why?
Introduce the OrganizationDelete GraphQL mutation, which leverages the existing Organizations::SoftDeletionService.
References
Implements Add OrganizationDelete GraphQL mutation and expose state fields
Screenshots or screen recordings
N/A — backend service, no UI changes.
| Before | After |
|---|---|
| N/A | N/A |
Database queries
::Organizations::OrganizationDetail.with_organization_ids(::Organizations::Organization.limit(100).select(:id))explain SELECT "organization_details"."organization_id", "organization_details"."created_at", "organization_details"."updated_at", "organization_details"."cached_markdown_version", "organization_details"."description", "organization_details"."description_html", "organization_details"."avatar", "organization_details"."state_metadata", "organization_details"."soft_deleted_at" FROM "organization_details" WHERE "organization_details"."organization_id" IN (SELECT "organizations"."id" FROM "organizations" LIMIT 100)Plan with execution:
Nested Loop (cost=3.40..39.19 rows=100 width=128) (actual time=2.336..3.508 rows=92 loops=1)
Buffers: shared hit=189 read=5
-> HashAggregate (cost=3.25..4.25 rows=100 width=8) (actual time=0.806..0.839 rows=100 loops=1)
Group Key: organizations.id
Buffers: shared read=2
-> Limit (cost=0.14..3.00 rows=100 width=8) (actual time=0.737..0.763 rows=100 loops=1)
Buffers: shared read=2
-> Index Only Scan using organizations_pkey on public.organizations (cost=0.14..6.46 rows=221 width=8) (actual time=0.735..0.749 rows=100 loops=1)
Heap Fetches: 0
Buffers: shared read=2
-> Index Scan using organization_details_pkey on public.organization_details (cost=0.14..0.39 rows=1 width=128) (actual time=0.026..0.026 rows=1 loops=100)
Index Cond: (organization_details.organization_id = organizations.id)
Buffers: shared hit=189 read=3
Settings: random_page_cost = '1.5', work_mem = '230MB', seq_page_cost = '4', effective_cache_size = '472585MB', jit = 'off'Summary:
Time: 5.001 ms
- planning: 1.353 ms
- execution: 3.648 ms
- I/O read: N/A
- I/O write: N/A
Shared buffers:
- hits: 189 (~1.50 MiB) from the buffer pool
- reads: 5 (~40.00 KiB) from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0Details and visualization: https://postgres.ai/console/gitlab/gitlab-production-main/sessions/52193/commands/153719.
How to set up and validate locally
Example GraphQL query:
mutation {
organizationDelete(id: "gid://gitlab/Organizations::Organization/<ORG_ID>") {
organization {
id
state
}
}
}MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Rémy Coutable