Files
probo/pkg/coredata/migrations/20251205T154956Z.sql
manish-singh-bisht 4dfe61ba0b 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>
2025-12-08 10:00:36 +01:00

11 lines
510 B
SQL

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;