Schema - MLT-NYC/mxpx GitHub Wiki

Database Schema

users

column name data type details
id integer not null, primary key
name string not null
email string not null, indexed, unique
password_digest string not null
session_token string not null, indexed
created_at datetime not null
updated_at datetime not null

pictures

column name data type details
id integer not null, primary key
photographer_id integer not null, indexed, foreign key
img_url string not null
title string not null
description string not null
created_at datetime not null
updated_at datetime not null
  • photographer_id references users
  • index on photographer_id

follows

column name data type details
id integer not null, primary key
follower_id integer not null, indexed, foreign key
followee_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • follower_id references users
  • followee_id references users
  • index on [:follower_id, :followee_id], unique: true

comments

column name data type details
id integer not null, primary key
author_id integer not null, indexed, foreign key
picture_id integer not null, indexed, foreign key
body string not null
created_at datetime not null
updated_at datetime not null
  • author_id references users
  • picture_id references pictures

likes

column name data type details
id integer not null, primary key
liker_id integer not null, indexed, foreign key
picture_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • liker_id references users
  • picture_id references pictures
  • index on [:liker_id, :picture_id], unique: true