Schema - Hitch77/FullStack_IMDb GitHub Wiki
Schema
Users
Column Name | Datatype | Details |
---|---|---|
id | integer | not null, primary key |
username | string | not null, indexed, unique |
string | not null, indexed, unique | |
session_token | string | not null, indexed, unique |
password_digest | string | not null |
created_at | datetime | not null |
updated_at | datetime | not null |
- validates presence of username, email
Movies
Column Name | Datatype | Details |
---|---|---|
id | integer | not null, primary key |
title | string | not null, indexed |
year | integer | not null, indexed |
film_rating | string | not null |
duration | string | not null |
director_id | integer | not null, indexed, foreign key |
writer_id | integer | not null, indexed, foreign key |
actor_id | integer | not null, indexed, foreign key |
description | text | not null |
created_at | datetime | not null |
updated_at | datetime | not null |
- director_id references users
- writer_id references users
- actor_id references users
Reviews
Column Name | Datatype | Details |
---|---|---|
id | integer | not null, primary key |
title | string | not null |
movie_id | string | not null, indexed, foreign key |
reviewer_id | integer | not null, indexed, foreign key |
body | text | not null |
rating | float | not null |
created_at | datetime | not null |
updated_at | datetime | not null |
- movie_id references movies
- reviewer_id references users
Likes
Column Name | Datatype | Details |
---|---|---|
id | integer | not null, primary key |
liker_id | integer | not null, foreign key, indexed |
review_id | integer | not null, foreign key, indexed |
- liker_id references users
- review_id references reviews