Database Schema - GaronHock/InstaGaron GitHub Wiki
Welcome to the InstaGaron wiki!
DATABASE SCHEMA
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 |
biography |
text |
n/a |
session_token |
string |
null |
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
photos
Column name |
Data-type |
Details |
id |
integer |
unique, indexed,not null primary key |
user_id |
integer |
unique, indexed, foreign_key |
description |
text |
n/a |
created_at |
datetime |
not null |
updated_at |
datetime |
not null |
- index on
id
unique: true
- index on
user_id
unique: true
user_id
references user
comments
Column name |
Data-type |
Details |
id |
integer |
not null, unique, indexed, primary key |
created_at |
datetime |
not null |
updated_at |
datetime |
not null |
user_id |
integer |
not null, foreign_key |
body |
text |
n/a |
photo_id |
integer |
not_null, foreign_key |
- index on
user_id
unique: true, null:false
- user_id references user
Likes
Column name |
Data-type |
Details |
id |
integer |
not null, unique, indexed |
user_id |
integer |
not null, unique, indexed,foreign_key |
photo_id |
integer |
not null |
created_at |
datetime |
not null |
updated_at |
datetime |
not null |
- index on
user_id
unique: true, null: false
- index on
user_id
unique: true, null: false
user_id
references users
followers
Column name |
Data-type |
Details |
id |
integer |
not null, primary key |
follower_id |
integer |
not null, foreign_key |
follower_user_id |
integer |
not null, foreign_key |
created_at |
datetime |
not null |
updated_at |
datetime |
not null |
- index on
user_id
unique: true, null: false