Skip to content
yangc95 edited this page Mar 19, 2021 · 8 revisions

Postgres Database Schema

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

pins

column name data type details
id integer not null, primary key
title string not null
about text not null
user_id integer not null
board_id integer not null
created_at datetime not null
updated_at datetime not null

boards

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

follows

column name data type details
id integer not null, primary key
following_id integer indexed
followed_id integer indexed
board_id integer indexed
created_at datetime not null
updated_at datetime not null
  • index on following_id
  • index on followed_id
  • index on board_id
Clone this wiki locally