Database Schema - MattMav21/Picture-Perfect-Project GitHub Wiki
1. Users
Column Name |
Data Type |
Details |
id |
integer |
not null, primary key |
username |
string |
not null, unique |
email |
string |
not null, unique |
hashedPassword |
string |
not null |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
- Sequelize Associations
- hasMany Albums (foreign key: userId)
- hasMany Pictures (foreign key: userId)
- hasMany Comments (foreign key: userId)
2. Pictures
Column Name |
Data Type |
Details |
id |
integer |
not null, primary key |
imageLink |
string |
not null |
title |
string |
|
description |
string |
|
userId |
integer |
not null |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
- Sequelize Associations
- hasMany Comments (foreign key: pictureId)
- hasMany Picture_Comments (foreign key: pictureId)
- hasMany Tags (foreign key: pictureId)
- hasMany Album_Pictures (foreign key: pictureId)
- belongsToOne User (foreign key: userId)
- belongsToMany Albums (foreign key: albumId)
3. Albums
Column Name |
Data Type |
Details |
id |
integer |
not null, primary key |
title |
string |
|
description |
string |
|
userId |
integer |
not null |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
- Sequelize Associations
- hasMany Comments (foreign key: albumId)
- hasMany Pictures (foreign key: albumId)
- hasMany Album_Pictures (foreign key: albumId)
- hasMany Tags (foreign key: albumId)
- belongsToOne User (foreign key: userId)
4. Album_Pictures
Column Name |
Data Type |
Details |
id |
integer |
not null, primary key |
albumId |
integer |
not null |
pictureId |
integer |
not null |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
- Sequelize Associations
- belongsToOne Album (foreign key: albumId)
- belongsToOne Picture (foreign key: pictureId)
Comments
Column Name |
Data Type |
Details |
id |
integer |
not null, primary key |
value |
string |
not null |
userId |
string |
not null |
pictureId |
string |
not null |
albumId |
string |
not null |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
- Sequelize Associations
- hasMany Picture_Comments (foreign key: commentId)
- belongsToOne User (foreign key: userId)
- belongsToOne Album (foreign key: albumId)
- belongsToOne Picture (foreign key: pictureId)
Album_Comments
Column Name |
Data Type |
Details |
id |
integer |
not null, primary key |
albumId |
string |
not null |
commentId |
string |
not null |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
- Sequelize Associations
- belongsToOne Album (foreign key: albumId)
- belongsToOne Comment (foreign key: commentId)
Picture_Comments
Column Name |
Data Type |
Details |
id |
integer |
not null, primary key |
pictureId |
string |
not null |
commentId |
string |
not null |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
- Sequelize Associations
- belongsToOne Picture (foreign key: pictureId)
- belongsToOne Comment (foreign key: commentId)
Tags
Column Name |
Data Type |
Details |
id |
integer |
not null, primary key |
query |
string |
not null |
albumId |
string |
not null |
pictureId |
string |
not null |
createdAt |
datetime |
not null |
updatedAt |
datetime |
not null |
- Sequelize Associations
- belongsToOne Album (foreign key: albumId)
- belongsToOne Picture (foreign key: pictureId)