diff --git a/pkg/coredata/migrations/20251205T154956Z.sql b/pkg/coredata/migrations/20251205T154956Z.sql index 4a6fdd96c..b3798dbe1 100644 --- a/pkg/coredata/migrations/20251205T154956Z.sql +++ b/pkg/coredata/migrations/20251205T154956Z.sql @@ -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; \ No newline at end of file