37 lines
1.2 KiB
MySQL
37 lines
1.2 KiB
MySQL
|
-- recipe
|
||
|
create table if not exists recipe (
|
||
|
id serial primary key,
|
||
|
title varchar(60) not null UNIQUE,
|
||
|
description text not null default '',
|
||
|
image varchar(42) not null,
|
||
|
cooking_time varchar(16) not null,
|
||
|
servings smallint not null default 1,
|
||
|
cal varchar(16) not null
|
||
|
);
|
||
|
-- recipe ingredients group
|
||
|
create table if not exists recipe_ingredients_group (
|
||
|
id serial primary key,
|
||
|
recipe_id integer references recipe(id) on delete cascade,
|
||
|
title varchar(26) default ''
|
||
|
);
|
||
|
-- recipe ingredients
|
||
|
create table if not exists recipe_ingredients (
|
||
|
recipe_ingredients_group_id integer references recipe_ingredients_group(id) on delete cascade,
|
||
|
ingredient text not null
|
||
|
);
|
||
|
-- recipe steps
|
||
|
create table if not exists recipe_steps (
|
||
|
recipe_id integer references recipe(id) on delete cascade,
|
||
|
step_num integer not null,
|
||
|
step_text text not null
|
||
|
);
|
||
|
-- recipe advices
|
||
|
create table if not exists recipe_advices (
|
||
|
recipe_id integer references recipe(id) on delete cascade,
|
||
|
advice text
|
||
|
);
|
||
|
-- recipe categories
|
||
|
create table if not exists recipe_categories (
|
||
|
recipe_id integer references recipe(id) on delete cascade,
|
||
|
category text
|
||
|
);
|