fix(auth): enforce single role per user

Change the user_role primary key from (user_id, role) to user_id alone, so each user holds at most one role row.
This commit is contained in:
siujamo committed 2026-08-06 17:51:38 +08:00
1 parent b131738dda
commit ac877ab8f0
1 file changed
+1 -1
@@ -2,5 +2,5 @@ CREATE TABLE user_role
(
user_id BIGINT NOT NULL REFERENCES app_user (id),
role VARCHAR(32) NOT NULL,
CONSTRAINT user_role_pkey PRIMARY KEY (user_id, role)
CONSTRAINT user_role_pkey PRIMARY KEY (user_id)
);