-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
Michelle Naim edited this page Oct 16, 2020
·
13 revisions
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
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 |
- 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, indexed |
description |
string | not null |
year |
integer | not null |
rating |
string | not null |
runtime |
string | not null |
url |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
title
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| genre_id | integer | not null, indexed, foreign key |
| movie_id | integer | not null, indexed, foreign key |
- index on
movie_id -
movie_idreferences movies - index on
genre_id -
genre_idreferences genres
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, foreign key |
movie_id |
integer | not null, indexed, foreign key |
-
user_idreferences user -
movie_idreferences movies - index on
[:user_id, :movie_id], unique: true// We don't need a separate index foruser_idormovie_idbecause the first index adds it for us.
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
movie_id |
integer | not null, indexed, foreign key |
people_id |
integer | not null, indexed, foreign key |
role |
string | not null |
- index on
movie_id -
movie_idreferences movies - index on
people_id -
people_idreferences people
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null |