CREATE TABLE user_tb(
user_id INT PRIMARY KEY AUTO_INCREMENT,
user_name VARCHAR(10) NOT NULL,
user_email VARCHAR(30) NOT NULL UNIQUE,
user_nickname VARCHAR(20) NOT NULL UNIQUE,
user_password VARCHAR(255) NOT NULL
);
CREATE TABLE ingredient_tb(
ingre_id INT PRIMARY KEY AUTO_INCREMENT,
ingre_name VARCHAR(30) NOT NULL,
ingre_save_type VARCHAR(10) NOT NULL,
ingre_category VARCHAR(10) NOT NULL,
ingre_expiration_date DATE NOT NULL,
ingre_count INT NOT NULL,
ingre_memo VARCHAR(100),
FOREIGN KEY (user_id)
REPERENCES user_tb(user_id) DELETE ON CASCADE
);
CREATE TABLE recipe_tb(
recipe_id INT PRIMARY KEY AUTO_INCREMENT,
recipe_name VARCHAR(30) NOT NULL,
recipe_ingredients VARCHAR(500) NOT NULL,
recipe_time INT NOT NULL,
recipe_level INT NOT NULL,
recipe_serving INT NOT NULL,
recipe_like INT NOT NULL,
recipe_visitor INT NOT NULL,
recipe_category VARCHAR(20) NOT NULL,
FOREIGN KEY (user_id)
REPERENCES user_tb(user_id) DELETE ON CASCADE
);
- 이미지 1장만
- 우리가 공부를 해서 포스팅 구현
보류 냉장고 TB
CREATE TABLE refrigerator_tb(
refri_id INT PRIMARY KEY AUTO_INCREMENT,
refri_name VARCHAR(20) NOT NULL,
refri_type VARCHAR(10) NOT NULL,
FOREIGN KEY (user_id)
REPERENCES user_tb(user_id) ON UPDATE CASCADE
);