Skip to content
Josh Bubar edited this page Dec 8, 2020 · 11 revisions

Postgres Database Schema

users

column name data type details
id integer not null, primary key
full_name string not null, indexed
email string not null, indexed, unique
team_id string not null, indexed, unique
password_digest string not null
session_token string not null, indexed, unique
created_at datetime not null
updated_at datetime not null
  • index on email, unique: true
  • index on team_id
  • index on full_name
  • index on session_token, unique: true

team

column name data type details
id integer not null, primary key
name string not null, indexed, unique
created_at datetime not null
updated_at datetime not null
  • index on name, unique: true

projects

column name data type details
id integer not null, primary key
name text not null
description text
due_date date
owner_id integer not null, indexed, foreign key
team_id string not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • owner_id references users
  • team_id references users
  • index on owner_id
  • index on team_id

sections

column name data type details
id integer not null, primary key
body string not null
project_id integer not null, indexed, foreign key
created_at datetime not null
updated at datetime not null
  • author_id references users
  • project_id references projects
  • index on author_id
  • index on project_id

tasks

column name data type details
id integer not null, primary key
body text not null
section_id integer not null, indexed, foreign key
assignee_id integer indexed, foreign key
due_date date
status datetime not null
updated_at datetime not null
  • section_id references sections
  • assignee_id references users
  • index on section_id
  • index on assignee_id

task_collaborators

column name data type details
id integer not null, primary key
collaborator_id integer not null, indexed, foreign key
task_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • collaborator_id references users
  • task_id references tasks
  • index on [:task_id, :collaborator_id], unique: true

fields

column name data type details
id integer not null, primary key
project_id integer not null, indexed, foreign key
title text not null
description text
created_at datetime not null
updated_at datetime not null
  • project_id references projects
  • index on project_id

tags

column name data type details
id integer not null, primary key
field_id integer not null, indexed, foreign key
body text not null
color text
created_at datetime not null
updated_at datetime not null
  • field_id references fields
  • index on field_id

favorites

column name data type details
id integer not null, primary key
user_id integer not null, indexed, foreign key
project_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • user_id references users
  • project_id references projects
  • index on [:project_id, :user_id], unique: true

Clone this wiki locally