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
referencesusers
- 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
referencesusers
followee_id
referencesusers
- 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
referencesusers
picture_id
referencespictures
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
referencesusers
picture_id
referencespictures
- index on
[:liker_id, :picture_id], unique: true