Database Schema - KevKodes/open-eats GitHub Wiki
Database Schema
Users
Attribute Name | Attribute Type | Constraints |
---|---|---|
id | integer | Primary Key, Not Null |
firstName | varchar | Not Null, 35 chars or less |
lastName | varchar | Not Null, 35 chars or less |
varchar | Not Null, Unique, 256 chars or less | |
hashedPassword | varchar | Not Null |
createdAt | datetime | Not Null |
updatedAt | datetime | Not Null |
Model Associations:
- Unique index on
email
- Migration
hasMany
Reviews
association. - Migration
hasMany
Favorites
association. - Migration
hasMany
Reservations
association.
Favorites
Attribute Name | Attribute Type | Constraints |
---|---|---|
id | integer | Primary Key, Not Null |
userId | integer | Foreign Key, Not Null |
restaurantId | integer | Foreign Key, Not Null |
createdAt | datetime | Not Null |
updatedAt | datetime | Not Null |
Model Associations:
- Migration
belongsTo
Users
association. - Migration
belongsTo
Restaurants
association.
Restaurants
Attribute Name | Attribute Type | Constraints |
---|---|---|
id | integer | Primary Key, Not Null |
name | varchar | Not Null, 35 chars or less |
description | varchar | 10000 chars or less |
cuisineType | varchar | 30 chars or less |
mainImageUrl | varchar | Not Null |
address | varchar | Not Null, 50 chars or less |
city | varchar | Not Null, 20 chars or less |
state | varchar | Not Null, 20 chars or less |
phone | varchar | Not Null, 15 chars or less |
createdAt | datetime | Not Null |
updatedAt | datetime | Not Null |
Model Associations:
- Migration
hasMany
Reviews
association. - Migration
hasMany
Favorites
association. - Migration
hasMany
Reservations
association. - Migration
hasMany
Photos
association.
Reservations
Attribute Name | Attribute Type | Constraints |
---|---|---|
id | integer | Primary Key, Not Null |
partySize | integer | Not Null |
reservationDate | datetime | Not Null |
reservationTime | time | Not Null |
userId | integer | Foreign Key, Not Null |
restaurantId | integer | Foreign Key, Not Null |
occasion | varchar | 255 chars or less |
request | varchar | 255 chars or less |
createdAt | datetime | Not Null |
updatedAt | datetime | Not Null |
Model Associations:
- Migration
belongsTo
Users
association. - Migration
belongsTo
Restaurants
association.
Photos
Attribute Name | Attribute Type | Constraints |
---|---|---|
id | integer | Primary Key, Not Null |
imageUrl | varchar | Not Null |
restaurantId | integer | Foreign Key, Not Null |
createdAt | datetime | Not Null |
updatedAt | datetime | Not Null |
Model Associations:
- Migration
belongsTo
Restaurants
association.
Reviews
Attribute Name | Attribute Type | Constraints |
---|---|---|
id | integer | Primary Key, Not Null |
overallRating | integer | Not Null |
foodRating | integer | Not Null |
serviceRating | integer | Not Null |
ambienceRating | integer | Not Null |
description | varchar | 10000 chars or less |
userId | integer | Foreign Key, Not Null |
restaurantId | integer | Foreign Key, Not Null |
createdAt | datetime | Not Null |
updatedAt | datetime | Not Null |
Model Associations:
- Migration
belongsTo
Users
association. - Migration
belongsTo
Restaurants
association.