ALTER TABLE permission.role_permissions
    ADD CONSTRAINT unique_role_permission
        UNIQUE (roleid, permissionid);

ALTER TABLE permission.api_key_permissions
    ADD CONSTRAINT unique_api_key_permission
        UNIQUE (apikeyid, permissionid);

ALTER TABLE permission.role_users
    ADD CONSTRAINT unique_role_user
        UNIQUE (roleid, userid);

ALTER TABLE public.user_settings
    ADD CONSTRAINT unique_user_setting
        UNIQUE (userid, key);

ALTER TABLE system.settings
    ADD CONSTRAINT unique_system_setting
        UNIQUE (key);

ALTER TABLE system.feature_flags
    ADD CONSTRAINT unique_feature_flag
        UNIQUE (key);
