Skip to content

User roles

user_roles

  • Schema: public
  • PK: user_role_id (uuid, gen_random_uuid())

Columns

Column Type Nullable Default Notes
user_role_id uuid NO gen_random_uuid() PK
user_id bigint NO FK to users
workspace_id bigint NO FK to workspaces
role_type varchar YES e.g. owner, admin, member
notification_preferences json YES Per-workspace notification config

Key indexes

  • user_roles_pkey on (user_role_id)
  • user_workspace_constraint UNIQUE on (user_id, workspace_id)

Notes

  • Maps users to workspaces with a role.
  • The unique constraint enforces one role per user per workspace.