122 lines
2.5 KiB
MySQL
122 lines
2.5 KiB
MySQL
|
CREATE TABLE keylookup (
|
||
|
id INTEGER NOT NULL,
|
||
|
word TEXT,
|
||
|
item TEXT,
|
||
|
ingkey TEXT,
|
||
|
count INTEGER,
|
||
|
PRIMARY KEY (id)
|
||
|
);
|
||
|
CREATE TABLE info (
|
||
|
version_super INTEGER,
|
||
|
version_major INTEGER,
|
||
|
version_minor INTEGER,
|
||
|
last_access INTEGER,
|
||
|
rowid INTEGER NOT NULL,
|
||
|
PRIMARY KEY (rowid)
|
||
|
);
|
||
|
CREATE TABLE recipe (
|
||
|
id INTEGER NOT NULL,
|
||
|
title TEXT,
|
||
|
instructions TEXT,
|
||
|
modifications TEXT,
|
||
|
cuisine TEXT,
|
||
|
rating INTEGER,
|
||
|
description TEXT,
|
||
|
source TEXT,
|
||
|
preptime INTEGER,
|
||
|
cooktime INTEGER,
|
||
|
servings FLOAT,
|
||
|
yields FLOAT,
|
||
|
yield_unit VARCHAR(32),
|
||
|
image BLOB,
|
||
|
thumb BLOB,
|
||
|
deleted BOOLEAN,
|
||
|
recipe_hash VARCHAR(32),
|
||
|
ingredient_hash VARCHAR(32),
|
||
|
link TEXT,
|
||
|
last_modified INTEGER,
|
||
|
PRIMARY KEY (id),
|
||
|
CHECK (deleted IN (0, 1))
|
||
|
);
|
||
|
CREATE TABLE plugin_info (
|
||
|
plugin TEXT,
|
||
|
id INTEGER NOT NULL,
|
||
|
version_super INTEGER,
|
||
|
version_major INTEGER,
|
||
|
version_minor INTEGER,
|
||
|
plugin_version VARCHAR(32),
|
||
|
PRIMARY KEY (id)
|
||
|
);
|
||
|
CREATE TABLE categories (
|
||
|
id INTEGER NOT NULL,
|
||
|
recipe_id INTEGER,
|
||
|
category TEXT,
|
||
|
PRIMARY KEY (id),
|
||
|
FOREIGN KEY(recipe_id) REFERENCES recipe (id)
|
||
|
);
|
||
|
CREATE TABLE ingredients (
|
||
|
id INTEGER NOT NULL,
|
||
|
recipe_id INTEGER,
|
||
|
refid INTEGER,
|
||
|
unit TEXT,
|
||
|
amount FLOAT,
|
||
|
rangeamount FLOAT,
|
||
|
item TEXT,
|
||
|
ingkey TEXT,
|
||
|
optional BOOLEAN,
|
||
|
shopoptional INTEGER,
|
||
|
inggroup TEXT,
|
||
|
position INTEGER,
|
||
|
deleted BOOLEAN,
|
||
|
PRIMARY KEY (id),
|
||
|
CHECK (deleted IN (0, 1)),
|
||
|
FOREIGN KEY(recipe_id) REFERENCES recipe (id),
|
||
|
FOREIGN KEY(refid) REFERENCES recipe (id),
|
||
|
CHECK (optional IN (0, 1))
|
||
|
);
|
||
|
CREATE TABLE IF NOT EXISTS "pantry" (
|
||
|
id INTEGER NOT NULL,
|
||
|
ingkey TEXT(32),
|
||
|
pantry BOOLEAN,
|
||
|
PRIMARY KEY (id),
|
||
|
CHECK (pantry IN (0, 1))
|
||
|
);
|
||
|
CREATE TABLE unitdict (
|
||
|
id INTEGER NOT NULL,
|
||
|
ukey VARCHAR(150),
|
||
|
value VARCHAR(150),
|
||
|
PRIMARY KEY (id)
|
||
|
);
|
||
|
CREATE TABLE crossunitdict (
|
||
|
id INTEGER NOT NULL,
|
||
|
cukey VARCHAR(150),
|
||
|
value VARCHAR(150),
|
||
|
PRIMARY KEY (id)
|
||
|
);
|
||
|
CREATE TABLE density (
|
||
|
id INTEGER NOT NULL,
|
||
|
dkey VARCHAR(150),
|
||
|
value VARCHAR(150),
|
||
|
PRIMARY KEY (id)
|
||
|
);
|
||
|
CREATE TABLE shopcatsorder (
|
||
|
id INTEGER NOT NULL,
|
||
|
shopcategory TEXT(32),
|
||
|
position INTEGER,
|
||
|
PRIMARY KEY (id)
|
||
|
);
|
||
|
CREATE TABLE convtable (
|
||
|
id INTEGER NOT NULL,
|
||
|
ckey VARCHAR(150),
|
||
|
value VARCHAR(150),
|
||
|
PRIMARY KEY (id)
|
||
|
);
|
||
|
CREATE TABLE IF NOT EXISTS "shopcats" (
|
||
|
id INTEGER NOT NULL,
|
||
|
ingkey TEXT(32),
|
||
|
shopcategory TEXT,
|
||
|
position INTEGER,
|
||
|
PRIMARY KEY (id)
|
||
|
);
|
||
|
CREATE TABLE IF NOT EXISTS "recipe_ingredients" ("Recipe_id" integer not null, "ingredientHash_id" integer not null, unique ("ingredientHash_id"));
|