Database Schema - GaronSmith/marvelous-movies GitHub Wiki
Users
column name |
data type |
details |
id |
integer |
not null, primary key |
userName |
string |
not null,unique |
firstName |
string |
not null |
lastName |
string |
not null |
email |
string |
not null |
bio |
string |
|
hashedPassword |
string |
not null |
createdAt |
DATETIME |
not null |
updatedAt |
DATETIME |
not null |
- unique index on username
- Sequelize belongsToMany Movies through BlockBusterShelves association
- Sequelize hasMany BlockBuster Shelves association
- Sequelize hasMany Reviews association
- Sequelize belongsToMany Users through Follows as Followers association
- Sequelize belongsToMany Users through Follows as Followings association
Movies
column name |
data type |
details |
id |
integer |
not null, primary key |
genre |
string |
not null |
title |
string |
not null |
releaseDate |
DATETIME |
not null |
description |
text |
not null |
imgPath |
string |
not null |
vote rating |
float |
not null |
vote count |
integer |
not null |
createdAt |
DATETIME |
not null |
updatedAt |
DATETIME |
not null |
- Sequelize hasMany Reviews association
- Sequelize belongsToMany Users through BlockBusterShelves association
- Sequelize hasMany BlockbusterShelves association
BlockBuster Shelves
column name |
data type |
details |
id |
integer |
not null, primary key |
userId |
integer |
not null, foreign key |
movieId |
integer |
not null,foreign key |
status |
string |
not null |
createdAt |
DATETIME |
not null |
updatedAt |
DATETIME |
not null |
- userId references Users table
- movieId references Movies table
- Sequelize belongsTo Users association
- Sequelize belongsTo Movies association
Reviews
column name |
data type |
details |
id |
integer |
not null, primary key |
userId |
integer |
not null, foreign key |
movieId |
integer |
not null, foreign key |
rating |
integer |
not null |
comment |
text |
|
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
- userId references Users table
- movieId references Movies table
- Sequelize belongsTo Users association
- Sequelize belongsTo Movies association
Follows
column name |
data type |
details |
id |
integer |
not null, primary key |
userId |
integer |
not null, foreign key |
followId |
integer |
not null,foreign key |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
- userId references Users table
- followId references Users table as UsersFollowed association
- Sequelize belongsTo Many Users association through Users