Database Schema - malikmoss/mcflicc-w17-project-react GitHub Wiki
Welcome to the McFlicc-Project wiki!
McFlicc is a 'Flickr' clone, dedicated to posting pictures of non-traditional McDonald's around the world.
Schema for PostgresQL using Sequelize
Schema Diagram
Users
| column name |
data type |
details |
id |
integer |
not null, primary key |
username |
string |
not null, indexed, unique |
email |
string |
not null, indexed, unique |
hashedPassword |
string |
not null |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
- unique index on
username
- unique index on
email
- Sequelize
hasMany Photos association
- Sequelize
hasMany Comments association
Photos
| column name |
data type |
details |
id |
integer |
not null, primary key |
photo |
image |
not null |
albumId |
integer |
not null |
userId |
integer |
not null, indexed, foreign key |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
userId references Users table
- index on
authorId
- Sequelize
belongsTo Users association
- Sequelize
hasMany Tags association
Albums
| column name |
data type |
details |
id |
integer |
not null, primary key |
name |
varcahr |
not null |
userId |
integer |
not null, indexed, foreign key |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
userId references Users table
- unique index on
[photoId, userId]
- Sequelize
belongsTo Users association
- Sequelize
hasMany Photos association
Tags
| column name |
data type |
details |
id |
integer |
not null, primary key |
type |
varcahr |
not null |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
- Sequelize
belongsTo Photos association
Comments
| column name |
data type |
details |
id |
integer |
not null, primary key |
photoId |
integer |
not null, indexed, foreign key |
userId |
integer |
not null, indexed, foreign key |
body |
string |
not null |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
photoId references Photos table
userId references Users table
- Sequelize
belongsTo photoId association
- Sequelize
belongsTo userId association
photos_tags
| column name |
data type |
details |
photoId |
integer |
not null, primary key |
tagId |
integer |
not null, indexed, foreign key |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |