Skip to content

Commit c8fe7ed

Browse files
author
Vianpyro
committed
Add category and recipe_category tables to database schema
1 parent fa62b7f commit c8fe7ed

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

database.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,16 @@ CREATE OR REPLACE TABLE recipe_rating (
180180
FOREIGN KEY (recipe_id) REFERENCES recipe (recipe_id) ON DELETE CASCADE,
181181
UNIQUE (person_id, recipe_id)
182182
) ENGINE = InnoDB;
183+
184+
CREATE OR REPLACE TABLE category (
185+
category_id INT AUTO_INCREMENT PRIMARY KEY,
186+
category_name VARCHAR(50) UNIQUE
187+
) ENGINE = InnoDB;
188+
189+
CREATE OR REPLACE TABLE recipe_category (
190+
recipe_id INT,
191+
category_id INT,
192+
PRIMARY KEY (recipe_id, category_id),
193+
FOREIGN KEY (recipe_id) REFERENCES recipe (recipe_id) ON DELETE CASCADE,
194+
FOREIGN KEY (category_id) REFERENCES category (category_id) ON DELETE CASCADE
195+
) ENGINE = InnoDB;

0 commit comments

Comments
 (0)