DB Schema
Nico G Pierson edited this page Aug 20, 2021
·
16 revisions
column name | data type | details | key |
---|---|---|---|
id | integer | NOT NULL | PK |
username | string | NOT NULL | |
string | NOT NULL, UNIQUE | ||
hashed_password | string | NOT NULL | |
created_at | timestamp | NOT NULL | |
updated_at | timestamp | NOT NULL |
- a
User
has manyRecipes
- a
User
has manyComments
- a
User
has manyLikes
column name | data type | details | key |
---|---|---|---|
id | integer | NOT NULL | PK |
img_url | string | NULL | |
name | string | NULL | |
user_id | integer | NOT NULL | FK |
created_at | timestamp | NOT NULL | |
updated_at | timestamp | NOT NULL |
-
Recipes
belongs toUsers
-
Recipes
has manyComments
column name | data type | details | key |
---|---|---|---|
id | integer | NOT NULL | PK |
ingredient | string | NOT NULL | |
measurement | string | NOT NULL | |
recipe_id | integer | NOT NULL | FK |
created_at | timestamp | NOT NULL | |
updated_at | timestamp | NOT NULL |
-
Recipe_ingredients
belongs toRecipes
column name | data type | details | key |
---|---|---|---|
id | integer | NOT NULL | PK |
steps | integer | NOT NULL | |
directions | string | NOT NULL | |
recipe_id | integer | NOT NULL | FK |
created_at | timestamp | NOT NULL | |
updated_at | timestamp | NOT NULL |
-
Recipe_directions
belongs toRecipes
column name | data type | details | key |
---|---|---|---|
id | integer | NOT NULL | PK |
video_url | string | NULL | |
img_url | string | NULL | |
recipe_id | integer | NULL | FK |
created_at | timestamp | NOT NULL | |
updated_at | timestamp | NOT NULL |
-
Recipe_photos
belongs toRecipes
column name | data type | details | key |
---|---|---|---|
id | integer | NOT NULL | PK |
comment | text | NULL | |
user_id | integer | NOT NULL | FK |
recipe_id | integer | NOT NULL | FK |
created_at | timestamp | NOT NULL | |
updated_at | timestamp | NOT NULL |
-
Comments
belongs toUsers
-
Comments
belongs toRecipes
column name | data type | details | key |
---|---|---|---|
id | integer | NOT NULL | PK |
user_id_follow_owner | integer | NOT NULL | FK |
user_id_follower | integer | NOT NULL | FK |
-
Users
has and belongs to manyUsers
column name | data type | details | key |
---|---|---|---|
id | integer | NOT NULL | PK |
user_id | integer | NOT NULL | FK |
recipe_id | integer | NOT NULL | FK |
created_at | timestamp | NOT NULL | |
updated_at | timestamp | NOT NULL |
-
Likes
belongs toUsers
-
Likes
belongs toRecipes