Skip to content

Database Schema

Christopher Lee edited this page Dec 27, 2017 · 3 revisions

Base Schema

users

Column Name Data Type Detail
username string not null, indexed, unique
password_digest string not null
session_token string not null
profile_picture_id integer foreign key (belongs_to relationship to pictures table)
created_at datetime not null
updated_at datetime not null

pictures

Column Name Data Type Detail
title string not null
description text not null
image_url string not null
author_id integer not null, foreign key (belongs_to relationship to users table)
created_at datetime not null
updated_at datetime not null

comments

Column Name Data Type Detail
picture_id integer not null, foreign key (belongs_to relationship to pictures table)
author_id integer not null, foreign key (belongs_to relationship to users table
body text not null
created_at datetime not null
updated_at datetime not null

BONUS Schema

likes

Column Name Data Type Detail
picture_id integer not null, foreign key (belongs_to relationship to pictures table)
liker_id integer not null, foreign key (belongs_to relationship to users table)
created_at datetime not null
updated_at datetime not null

follows

Column Name Data Type Detail
follower_id integer not null, foreign key (belongs_to relationship to users table)
followee_id integer not null, foreign key (belongs_to relationship to users table)
created_at datetime not null
updated_at datetime not null

Clone this wiki locally