-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschema.sql
More file actions
48 lines (45 loc) · 1.03 KB
/
schema.sql
File metadata and controls
48 lines (45 loc) · 1.03 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
DROP TABLE IF EXISTS substitutions;
DROP TABLE IF EXISTS recipes;
DROP TABLE IF EXISTS users;
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name VARCHAR(255)
);
CREATE TABLE recipes (
id SERIAL PRIMARY KEY,
recipe_name VARCHAR(255),
ingredients TEXT,
url VARCHAR(255),
source VARCHAR(255),
image_url VARCHAR(255),
servings INTEGER,
calories INTEGER,
total_fat INTEGER,
saturated_fat INTEGER,
cholesterol INTEGER,
sodium INTEGER,
total_carbohydrate INTEGER,
dietary_fiber INTEGER,
sugars INTEGER,
protein INTEGER,
potassium INTEGER,
health_labels VARCHAR(255),
diet_labels VARCHAR(255)
);
CREATE TABLE substitutions (
id SERIAL PRIMARY KEY,
ingredient VARCHAR(255),
addition BOOLEAN,
calories INTEGER,
total_fat INTEGER,
saturated_fat INTEGER,
cholesterol INTEGER,
sodium INTEGER,
total_carbohydrate INTEGER,
dietary_fiber INTEGER,
sugars INTEGER,
protein INTEGER,
potassium INTEGER,
recipe_id INTEGER NOT NULL,
FOREIGN KEY (recipe_id) REFERENCES recipes(id)
);