Add strategy hooks for project children with side effects
Summary
Audit which project child tables need more than a raw SQL DELETE during pre-drain. Implement strategy hooks for each one.
Raw DELETE skips Rails callbacks. Some tables rely on those callbacks for external cleanup. This issue adds hooks so those tables are handled correctly.
Requirements
- Audit project children. Identify every
CASCADEFK child ofprojectsthat has side effects on delete. Likely candidates:- Uploads and attachments (object storage cleanup)
- Container registry blobs
- Repository storage references
- Search index entries
- Tables with
dependent: :destroycallbacks that do external work
- Register a strategy hook for each. Use the per-table hook interface from the pre-drain helper. Each hook routes deletes through the appropriate service instead of raw SQL.
- Document the audit. Record which tables need hooks and which are safe with raw
DELETE, so future tables can follow the same pattern.
Specs
- Hooks called for registered tables during pre-drain
- External cleanup triggered (object storage, search index, etc.)
- Tables without hooks still use raw
DELETE
Dependencies
Depends on wiring up pre-drain in Projects::DestroyService (#619117).
References
- Parent epic: gitlab-org#23353
- Design document MR: gitlab-com/content-sites/handbook!20016
Edited by 🤖 GitLab Bot 🤖