This repository was archived by the owner on Jan 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Schema
Jon Tran edited this page Nov 16, 2020
·
12 revisions
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
email |
string | not null, indexed, unique |
first_name |
string | not null |
last_name |
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
email, unique: true
- index on
session_token, unique: true
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
title |
string | not null |
description |
string | not null |
uploader_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
uploader_id
referencesusers
- index on
uploader_id
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
body |
string | not null |
author_id |
integer | not null, indexed, foreign key |
video_id |
integer | not null, indexed, foreign key |
parent_comment_id |
integer | indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
author_id
referencesusers
-
video_id
referencesvideos
-
parent_comment_id
referencescomments
- index on
video_id
- index on
author_id
- index on
parent_comment_id
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
is_voted? |
boolean | not null |
voter_id |
integer | not null, indexed, foreign key |
votable_id |
integer | not null, indexed, foreign key |
votable_type |
string | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
voter_id
referencesusers
-
votable_id
referencesvideos
orcomments
-
[:votable_id, :votable_type]
polymorphic reference tovideos
orcomments
- index on
[:votable_type, :votable_id, :voter_id], unique: true
- index on
votable_id
- index on
voter_id
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
video_id |
integer | not null, indexed, foreign key |
viewer_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
video_id
referencesvideos
-
viewer_id
referencesusers
(q: how to incorporate anonymous views?) - index on
video_id
- index on
viewer_id
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
description |
string | |
links |
string | |
user_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
channel_id
referencesusers
- index on
user_id
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
subscriber_id |
integer | not null, indexed, foreign key |
channel_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
subscriber_id
referencesusers
-
channel_id
referenceschannel
- index on
[:channel_id, :subscriber_id], unique: true
- index on
subscriber_id