ch users <-> branches
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled

This commit is contained in:
guwandyk committed 2026-09-18 22:59:58 +05:00
1 parent d3e188affe
commit 0971158e98
9 files changed
+43 -18

No files matched your search

@@ -61,3 +61,10 @@ ALTER TABLE permission_role DROP CONSTRAINT IF EXISTS permission_role_permission
CREATE UNIQUE INDEX permission_role_permission_id_role_id_idx
ON permission_role (permission_id, role_id)
WHERE deleted_at IS NULL;
-- branch_user is many-to-many (a user may be assigned to several branches at
-- once); this index only stops the same pair being assigned twice while
-- active, so re-assigning it can be a no-op instead of a duplicate row.
CREATE UNIQUE INDEX branch_user_branch_id_user_id_idx
ON branch_user (branch_id, user_id)
WHERE deleted_at IS NULL;