Database Schema - slimjim49j/ViewTube GitHub Wiki

Database Schema

Users

column name datatype details
id integer not null, primary key
first_name string not null
last_name string not null
email string not null
password_digest string not null
session_token string
created_at datetime not null
updated_at datetime not null

Channels

column name datatype details
id integer not null, primary key
title string not null
description text
user_id integer not null, foreign key
created_at datetime not null
updated_at datetime not null

Videos

column name datatype details
id integer not null, primary key
title string not null
description text
channel_id integer not null, foreign key
created_at datetime not null
updated_at datetime not null

Comments

column name datatype details
id integer not null, primary key
body text not null
channel_id integer not null, foreign key
video_id integer not null, foreign key
parent_comment_id integer foreign key
created_at datetime not null
updated_at datetime not null

Likes

column name datatype details
id integer not null, primary key
likable_type string not null
likable_id integer not null, foreign key
channel_id integer not null, foreign key
dislike boolean not null
created_at datetime not null
updated_at datetime not null

Views

column name datatype details
id integer not null, primary key
video_id integer not null, foreign key
channel_id integer not null, foreign key
created_at datetime not null
updated_at datetime not null

extra tables:

Subscriptions

Playlists

Playlist Videos