Project tracker – ER diagram

PostgreSQL · 4 tables · 4 declared foreign keys · no application data

project_id user_id project_id assignee_id 0..N 1 0..N 1 0..N 1 0..N 0..1

project_members

project_idbigintPKFK
user_idbigintPKFK
rolevarchar(20)
Composite primary key (project_id, user_id): only the pair is unique. Either column on its own may repeat.

projects

idbigintPK
namevarchar(120)

users

idbigintPK
emailvarchar(255)UQ

tasks

idbigintPK
project_idbigintFK
assignee_idbigintFKNULL
titlevarchar(200)
external_ticket_idvarchar(80)NULL
external_ticket_id is an identifier from an external issue tracker, not a local foreign key (column comment). No connector is drawn for it.

Relationships

  1. project_members.project_idprojects.id1 : 0..N. Each membership belongs to exactly one project (NOT NULL). A project has zero or many memberships; project_id is not unique on its own (it is only half of the composite key).
  2. project_members.user_idusers.id1 : 0..N. Each membership belongs to exactly one user (NOT NULL). A user has zero or many memberships; user_id is not unique on its own.
  3. tasks.project_idprojects.id1 : 0..N. Each task belongs to exactly one project (NOT NULL). A project has zero or many tasks.
  4. tasks.assignee_idusers.id0..1 : 0..N. A task has zero or one assignee (the column is nullable). A user is assigned zero or many tasks.

Legend