Database Schema - meagan13/Family-Supper GitHub Wiki

Users
| column name |
data type |
details |
| id |
serial |
primary key |
| username |
string |
not nullable, unique |
| email |
string |
not nullable, unique |
| password |
string |
not nullable |
| imgUrl |
text |
not nullable |
| bio |
text |
not nullable |
| createdAt |
timestamp |
|
| updatedAt |
timestamp |
|
- A user has many recipes
- A user has many memories
Recipes
| column name |
data type |
details |
| id |
serial |
primary key |
| title |
string |
not nullable |
| author |
string |
not nullable |
| description |
string |
not nullable |
| food_img |
string |
|
| card_img |
string |
|
| category_id |
int |
not nullable |
| user_id |
int |
not nullable |
| createdAt |
timestamp |
|
| updatedAt |
timestamp |
|
- A recipe has many ingredients
- A recipe has many directions
- A recipe has many memories
- A recipe belongs to a user
- A recipe belongs to a category
Ingredients
| column name |
data type |
details |
| id |
serial |
primary key |
| amt |
float |
|
| measurement |
string |
|
| ingredient_name |
string |
not nullable |
| recipe_id |
int |
not nullable |
| createdAt |
timestamp |
|
| updatedAt |
timestamp |
|
- An ingredient belongs to a recipe
Directions
| column name |
data type |
details |
| id |
serial |
primary key |
| step_number |
int |
not nullable |
| recipe_id |
int |
not nullable |
| instruction |
text |
not nullable |
| createdAt |
timestamp |
|
| updatedAt |
timestamp |
|
- A direction belongs to a recipe
Categories
| column name |
data type |
details |
| id |
serial |
primary key |
| cat_name |
string |
not nullable |
- A category has many recipes
Memories
| column name |
data type |
details |
| id |
serial |
primary key |
| user_id |
int |
not nullable |
| memory_text |
string |
not nullable |
| recipe_id |
int |
not nullable |
| createdAt |
timestamp |
|
| updatedAt |
timestamp |
|
- A memory belongs to a user
- A memory belongs to a recipe