Tenant delete failed until foreign keys could cascade
Context
Multi-tenant data must be removable when a workspace is purged. Hard delete hit foreign key errors on child tables.
What went wrong
Most hq tables referenced the tenant without ON DELETE CASCADE. Purge was structurally impossible. That blocks real data-deletion obligations.
What we changed
I shipped a migration that cascades tenant-owned data on delete, while audit and billing-style rows keep SET NULL where the original design required it. A completeness check guards the graph.
Result
Tenant purge is a designed path, not a manual SQL hunt. Deletion behavior matches the data model on purpose.