Database Schema - KevinNatera/Fumblr GitHub Wiki
users
column | datatype | properties |
---|---|---|
id |
integer | null:false |
username |
string | null:false, index, unique |
email |
string | null:false, index, unique |
password_digest |
string | null:false |
session_token |
string | null:false, index, unique |
created_at |
datetime | null:false |
updated_at |
datetime | null:false |
- index on
username
,email
, andsession_token
- foreign key:
has_many posts
- foreign key:
has_many likes
- foreign key:
has_many comments
posts
column | datatype | properties |
---|---|---|
id |
integer | null:false |
author_id |
integer | null:false, index |
title |
string | null:false |
body |
string | none |
url |
string | none |
created_at |
datetime | null:false, |
updated_at |
datetime | null:false |
- index on
author_id
author_id
referencesusers
belongs_to author
- foreign key:
has_many likes
- foreign key:
has_many comments
comments
column | datatype | properties |
---|---|---|
id |
integer | null:false |
commenter_id |
integer | null:false, index |
post_id |
string | null:false, index |
body |
string | null:false |
created_at |
datetime | null:false, |
updated_at |
datetime | null:false |
- index on
commenter_id
andpost_id
commenter_id
referencesusers
post_id
referencesposts
belongs_to commenter
belongs_to post
likes
column | datatype | properties |
---|---|---|
id |
integer | null:false |
liker_id |
integer | null:false, index |
post_id |
string | null:false, index |
created_at |
datetime | null:false, |
updated_at |
datetime | null:false |
- index on
liker_id
andpost_id
liker_id
referencesusers
post_id
referencesposts
belongs_to liker
belongs_to post