-
Notifications
You must be signed in to change notification settings - Fork 9
Database Schema
ChrisCavs edited this page Jul 5, 2018
·
3 revisions
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null, indexed |
email |
string | not null, indexed, unique |
img_url |
string | not null |
password_digest |
string | not null |
session_token |
string | not null, indexed, unique |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
username, unique: true
- index on
session_token, unique: true
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
title |
string | not null |
subtitle |
string | not null |
body |
string | not null |
image_url |
string | not null |
author_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
author_id
referencesusers
- index on
author_id
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
author_id |
integer | not null, indexed, foreign key |
story_id |
integer | not null, indexed, foreign key |
body |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
author_id
referencesusers
-
story_id
referencesstories
- index on
author_id
- index on
story_id
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
follower_id |
integer | not null, indexed, foreign key |
followed_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
follower_id
andfollowed_id
referencesusers
- index on
[:follower_id, :followed_id], unique: true
- index on
follower_id
- index on
followed_id
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, foreign key |
clapable_id |
integer | not null, indexed, foreign key |
clapable_type |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
user_id
referencesusers
-
clapable_id
referencesstories
orcomments
(polymorphic) - index on
[:clapable_id, :user_id], unique: true
- index on
:user_id, unique: true