fix: add cascading of authz_memberships on org delete

Signed-off-by: manish-singh-bisht <mthefool218@gmail.com>
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
manish-singh-bisht
2025-12-05 22:00:28 +05:30
committed by Bryan Frimin
parent 0d741c3c85
commit 4dfe61ba0b

View File

@@ -1,5 +1,11 @@
DELETE FROM authz_invitations
WHERE organization_id NOT IN (SELECT id FROM organizations);
DELETE FROM authz_memberships
WHERE organization_id NOT IN (SELECT id FROM organizations);
ALTER TABLE authz_invitations ADD CONSTRAINT authz_invitations_organization_id_fkey
FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;
ALTER TABLE authz_memberships ADD CONSTRAINT authz_memberships_organization_id_fkey
FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;