Project tracker
PostgreSQL ER diagram · 4 tables · 5 declared foreign keys
users Table
| Column | SQL type | Keys |
|---|---|---|
| id | bigint NOT NULL · PK | PK |
| varchar(255) NOT NULL | UQ |
Primary key: id
project_members Table
| Column | SQL type | Keys |
|---|---|---|
| project_id | bigint NOT NULL | PK¹FK |
| user_id | bigint NOT NULL | PK¹FK |
| role | varchar(20) NOT NULL |
¹ Composite PK: (project_id, user_id)
The pair is unique; neither column is individually unique.
tasks Table
| Column | SQL type | Keys |
|---|---|---|
| id | bigint NOT NULL · PK | PK |
| project_id | bigint NOT NULL | FK |
| assignee_id | bigint NULL allowed | FK |
| title | varchar(200) NOT NULL | |
| external_ticket_id | varchar(80) NULL allowed | |
| reviewer_id | bigint NULL allowed | FK |
external_ticket_id identifies an external issue; it is not a local FK.
projects Table
| Column | SQL type | Keys |
|---|---|---|
| id | bigint NOT NULL · PK | PK |
| name | varchar(120) NOT NULL |
Primary key: id
Declared relationships
-
project_members.user_id → users.idEach membership has exactly 1 user; each user has 0..* memberships. -
project_members.project_id → projects.idEach membership has exactly 1 project; each project has 0..* memberships. -
tasks.project_id → projects.idEach task has exactly 1 project; each project has 0..* tasks. -
tasks.assignee_id → users.idEach task has 0..1 assignee; each user has 0..* assigned tasks. Unchanged by the migration. -
tasks.reviewer_id → users.idEach task has 0..1 reviewer; each user has 0..* tasks to review. Added by the migration.