KamoCRM

Add missing unique constraints for role-right upserts

FixInitializerService
Shipped
20 ஏப்ரல், 2026 அன்று 8:06 PM UTC
Author
Kamo
Commit
559376b

**************** + syncSecurityModelRoleRights use `ON CONFLICT (role_id, right_type) DO NOTHING` and `ON CONFLICT (default_role_id, right_type) DO NOTHING`, which require matching unique constraints on the DB tables. The matching `@UniqueConstraint` annotations on `OrgRoleRight` and **************** only take effect on CREATE TABLE, so existing databases never gained them — causing SecurityService startup to fail with `ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification`. Dedupe first in case legacy rows have duplicates that would block the ADD CONSTRAINT, then add both constraints idempotently via SchemaCleanupRunner.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing