Schema - alex-ciminillo/freeBook Wiki

Postgres Database Schema

users

column name data type details
id integer not null, primary key
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
first_name string not null
last_name string not null
birthday string not null
phone_number string

posts

column name data type details
id integer not null, primary key
body string not null
author_id integer not null, indexed, foreign key
image_url string
created_at datetime not null
updated_at datetime not null
feeling string

comments

column name data type details
id integer not null, primary key
body string not null
author_id integer not null, indexed, foreign key
post_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null

friends

column name data type details
id integer not null, primary key
second_user_id integer not null, indexed, foreign key
first_user_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null