-
Notifications
You must be signed in to change notification settings - Fork 1
/
ed-1.sql
49 lines (42 loc) · 1.37 KB
/
ed-1.sql
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 recipes_ingredients;
DROP TABLE IF EXISTS recipes;
DROP TABLE IF EXISTS ingredients;
DROP TABLE IF EXISTS quantities;
DROP TABLE IF EXISTS categories;
CREATE TABLE ingredients (
id bigserial primary key,
name text
);
CREATE TABLE quantities (
id bigserial primary key,
name text
);
CREATE TABLE categories (
id bigserial primary key,
name text
);
CREATE TABLE recipes (
id bigserial primary key,
category_id bigint references categories,
name text,
description text,
url text,
image text,
source text,
date_published DATE,
recipeyield int,
total_time int,
prep_time int,
cook_time int
);
CREATE TABLE recipes_ingredients (
id bigserial primary key,
recipe_id bigint NOT NULL references recipes,
ingredient_id bigint NOT NULL references ingredients,
quantity_id bigint NOT NULL references quantities,
quantity_count float
);
-- insert into recipes (name, description, url, image, source, date_published, recipeyield, total_time, cook_time, prep_time) values ('glass of water', 'just glass of water', 'www.water.com','www.water.com','www.water.com','2010-10-10',1,1,0,1);
-- insert into ingredients (name) values ('water');
-- insert into quantities (name) values ('glass');
-- insert into recipes_ingredients (recipe_id, ingredient_id, quantity_id, quantity_count) values (1, 1, 1, 1.0);