Skip to content

Database Schema

Justin Stoctkon edited this page Jul 22, 2022 · 16 revisions

image

Four main criteria and Users

Users

Column Name Data Type Details
id integer not null, primary key
username string(20) not null, unique
email string(100) not null, unique
hashedPassword string(100) not null
createdAt timestamp not null
updatedAt timestamp not null

Board Relationships Join table for Workspaces and Users

Column Name Data Type Details
id integer not null, primary key
userId integer not null, FK Users
cardId integer not null, FK Cards

Workspaces

Column Name Data Type Details
id integer not null, primary key
ownerId integer not null, FK Users
name string(50) not null

Stacks

Column Name Data Type Details
id integer not null, primary key
boardId integer not null, FK Boards
workspaceId integer not null, FK Workspaces
username string(20) not null
name string(50) not null
position integer not null, default 1

Boards

Column Name Data Type Details
id integer not null, primary key
workspaceId integer not null, FK Workspaces
username string(20) not null
name string(50) not null
color string(100)

Cards

Column Name Data Type Details
id integer not null, primary key
boardId integer not null, FK Boards
username string(20) not null
name string(50) not null
description Text not null
color string(100)
position integer not null, default 1

Bonus Features

image

Comments Bonus #1

Column Name Data Type Details
id integer not null, primary key
userId integer not null, FK Users
cardId integer not null, FK Cards
comment Text not null
createdAt timestamp not null
updatedAt timestamp not null

Checklists Bonus #2

Column Name Data Type Details
id integer not null, primary key
userId integer not null, FK Users
cardId integer not null, FK Cards
name string(50) not null
createdAt timestamp not null
updatedAt timestamp not null

Checklist Items Bonus #2

Column Name Data Type Details
id integer not null, primary key
checklistId integer not null, FK Checklists
checked Boolean not null, default False
name string(50) not null

Relationships Table

Model Has Many Belongs to Many Belongs to One
Users BoardRelationships, Workspaces, Comments, Boards, Stacks, Cards, Checklists N/A N/A
BoardRelationships N/A Users, Workspaces N/A
Workspaces BoardRelationships, Boards, Stacks Users Users (owner)
Boards Stacks N/A Workspaces
Stacks Cards N/A Boards, Workspaces
Cards Comments, Checklists N/A Stacks
Comments N/A N/A Cards, Users
Checklists ChecklistItems N/A Cards, Users
ChecklistItems N/A N/A Checklists

Clone this wiki locally