Schema - ladymicaela/trello-clone GitHub Wiki
users
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
username |
string | not null, indexed, unique |
email |
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
username, unique: true - index on
email, unique: true - index on
session_token, unique: true - has_many
created_boards - has_many
boardsthroughboard_memberships
boards
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
title |
string | not null |
creator_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
creator_idreferencesusers- index on
creator_id - belongs_to
creator - has_many
membersthroughboard_memberships - has_many
lists - has_many
cardsthroughlists
lists
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
title |
string | not null |
board_id |
integer | not null, indexed, foreign key |
order |
integer | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
board_idreferencesboards- index on
board_id - index on
[:order, :board_id], unique: true - belongs_to
board - has_many
cards
cards
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
title |
string | not null |
description |
text | |
due_date |
date | |
list_id |
integer | not null, indexed, foreign key |
order |
integer | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
list_idreferenceslists- index on
list_id - index on
[:order, :list_id], unique: true - belongs_to
list - has_many
comments
comments
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
body |
string | not null |
author_id |
integer | not null, indexed, foreign key |
card_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
author_idreferencesuserscard_idreferencescards- index on
author_id - index on
card_id - belongs_to
author - belongs_to
card
board_memberships
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
board_id |
integer | not null, indexed, foreign key |
member_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
board_idreferencesboardsmember_idreferencesusers- index on
[:board_id, :member_id], unique: true - belongs_to
member - belongs_to
board