Skip to content
Lawrence Menyah edited this page Sep 22, 2020 · 11 revisions

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
session_token string not null, indexed, unique
created_at datetime not null
updated_at datetime not null

Videos - has many likes as likeable/has many dislikes as dislikeable

column name data type details
id integer not null, primary key
title string not null, indexed
description text not null
uploader_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null

Likes - belongs to likeable, polymorphic true

column name data type details
id integer not null, primary key
likeable_id big int not null, indexed, foreign key
likeable_type integer not null, indexed, foreign key
type string not null, indexed
created_at datetime not null
updated_at datetime not null
INDEX - [likeable_id, likeable_type], type

Comments - has many likes as likeable/has many dislikes as dislikeable

column name data type details
id integer not null, primary key
body text not null
commenter_id integer not null, indexed, foreign key
parent_comment_id integer indexed, foreign key
video_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null

Subcribers(BONUS)

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