-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathcooking_recipe.sql
More file actions
30 lines (26 loc) · 933 Bytes
/
cooking_recipe.sql
File metadata and controls
30 lines (26 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
DROP SCHEMA IF EXISTS cooking_recipe CASCADE;
CREATE SCHEMA IF NOT EXISTS cooking_recipe;
DROP TABLE IF EXISTS cooking_recipe.recipe;
CREATE TABLE IF NOT EXISTS cooking_recipe.recipe (
recipe_id SERIAL PRIMARY KEY,
name TEXT,
description TEXT,
instructions TEXT
);
DROP TABLE IF EXISTS cooking_recipe.ingredient;
CREATE TABLE IF NOT EXISTS cooking_recipe.ingredient (
ingredient_id SERIAL PRIMARY KEY,
name TEXT
);
DROP TABLE IF EXISTS cooking_recipe.measure;
CREATE TABLE IF NOT EXISTS cooking_recipe.measure (
measure_id SERIAL PRIMARY KEY,
name TEXT
);
DROP TABLE IF EXISTS cooking_recipe.recipe_ingredient;
CREATE TABLE IF NOT EXISTS cooking_recipe.recipe_ingredient (
recipe_id INT REFERENCES cooking_recipe.recipe (recipe_id),
ingredient_id INT REFERENCES cooking_recipe.ingredient (ingredient_id),
measure_id INT REFERENCES cooking_recipe.measure (measure_id),
amount INT
);