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:
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)
|
||||
);
|
||||
Reference in new issue
Block a user