Skip to content

Database Schema

Dan edited this page Dec 31, 2019 · 10 revisions

users

column name data types detail
id integer not null, primary key
username string not null, indexed, unique
password_digest string not null
session_token string not null, indexed, unique
image_url string
  • index on username, unique: true
  • index on email, unique: true
  • index on session_token, unique: true

pictures

column name data types detail
id integer not null, primary key
title string not null, indexed, unique
image_url string
category_id integer not null, indexed, foreign key
  • index on title, unique: true
  • index on category_id
  • category_id references categories

categories

column name data types detail
id integer not null, primary key
title string not null, indexed, unique
  • index on title, unique: true

follows

column name data types detail
id integer not null, primary key
category_id integer not null, indexed, foreign key
user_id integer not null, indexed, foreign key
  • category_id references categories
  • user_id references users
  • index on [:category_id, :user_id], unique: true

Clone this wiki locally