20 lines
489 B
MySQL
20 lines
489 B
MySQL
|
CREATE TABLE IF NOT EXISTS ingredient (
|
||
|
id SERIAL,
|
||
|
name VARCHAR(64) UNIQUE NOT NULL,
|
||
|
icon VARCHAR(64),
|
||
|
price INT,
|
||
|
PRIMARY KEY(id));
|
||
|
|
||
|
CREATE TABLE IF NOT EXISTS recipe (
|
||
|
id SERIAL,
|
||
|
name VARCHAR(64) UNIQUE NOT NULL,
|
||
|
icon VARCHAR(64),
|
||
|
PRIMARY KEY(id));
|
||
|
|
||
|
CREATE TABLE IF NOT EXISTS recipe_ingredient (
|
||
|
recipe_id INT NOT NULL,
|
||
|
ingredient_d INT NOT NULL,
|
||
|
amount INT,
|
||
|
FOREIGN KEY (recipe_id) REFERENCES recipe(id),
|
||
|
FOREIGN KEY (ingredient_d) REFERENCES ingredient(id));
|