DB Schema - nicopierson/unwined GitHub Wiki
Database Schema
Users 👤
| column name |
data type |
details |
key |
| id |
integer |
NOT NULL |
PK |
| username |
string |
NOT NULL |
|
| email |
string |
NOT NULL, UNIQUE |
|
| hashedPassword |
string |
NOT NULL |
|
| created_at |
timestamp |
NOT NULL |
|
| updated_at |
timestamp |
NOT NULL |
|
Sequelize Associations
- hasMany
Wineries
- hasMany
Wines
- hasMany
Reviews
Wines 🍷
| column name |
data type |
details |
key |
| id |
integer |
NOT NULL |
PK |
| name |
varchar |
NOT NULL |
|
| imageUrl |
varchar |
NULL |
|
| description |
text |
NULL |
|
| province |
varchar |
NULL |
|
| country |
varchar |
NOT NULL |
|
| price |
decimal |
NOT NULL |
|
| rating |
integer |
NOT NULL |
|
| designation |
varchar |
NULL |
|
| region_1 |
varchar |
NULL |
|
| region_2 |
varchar |
NULL |
|
| userId |
integer |
NOT NULL |
FK |
| wineryId |
integer |
NOT NULL |
FK |
| colorTypeId |
integer |
NOT NULL |
FK |
| wineTypeId |
integer |
NOT NULL |
FK |
| created_at |
timestamp |
NOT NULL |
|
| updated_at |
timestamp |
NOT NULL |
|
Sequelize Associations
- belongsTo
Users
- belongsTo
Wineries
- hasMany
Reviews
- belongsTo
ColorType
- belongsTo
WineType
Wineries 🏪
| column name |
data type |
details |
key |
| id |
integer |
NOT NULL |
PK |
| name |
string |
NOT NULL, UNIQUE |
|
| country |
string |
NOT NULL |
|
| ownerId |
integer |
NOT NULL |
FK |
| created_at |
timestamp |
NOT NULL |
|
| updated_at |
timestamp |
NOT NULL |
|
Sequelize Associations
- belongsTo
Users
- hasMany
Wines
Reviews ✅
| column name |
data type |
details |
key |
| id |
integer |
NOT NULL |
PK |
| comments |
text |
NULL |
|
| userId |
integer |
NOT NULL |
FK |
| wineId |
integer |
NOT NULL |
FK |
| created_at |
timestamp |
NOT NULL |
|
| updated_at |
timestamp |
NOT NULL |
|
Sequelize Associations
- belongsTo
Users
- belongsTo
Wines
WineTypes 🍇
| column name |
data type |
details |
key |
| id |
integer |
NOT NULL |
PK |
| type |
varchar |
NOT NULL |
|
| created_at |
timestamp |
NOT NULL |
|
| updated_at |
timestamp |
NOT NULL |
|
Sequelize Associations
ColorTypes
| column name |
data type |
details |
key |
| id |
integer |
NOT NULL |
PK |
| color |
varchar |
NOT NULL |
|
| created_at |
timestamp |
NOT NULL |
|
| updated_at |
timestamp |
NOT NULL |
|
Sequelize Associations