Some more cleaning in tables
This commit is contained in:
parent
72d0380023
commit
1969d2f98f
1 changed files with 6 additions and 3 deletions
|
@ -36,20 +36,22 @@ CREATE TABLE IF NOT EXISTS orders (
|
||||||
);
|
);
|
||||||
|
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
-- Recipe/Cookie related tables
|
-- Raw materials, ingredients and recipes
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
-- Notes: the unit type can be defined in terms
|
-- Notes: the unit type can be defined in terms
|
||||||
-- of volume or weight instead. Here we choose
|
-- of volume or weight instead. Here we choose
|
||||||
-- to use static si-prefixes in relevant tables.
|
-- to use static si-prefixes in relevant tables.
|
||||||
|
|
||||||
-- What types of ingredients do we handle
|
-- What types of ingredients do we handle.
|
||||||
|
-- Not currently used, but kept as an example.
|
||||||
CREATE TABLE IF NOT EXISTS ingredients (
|
CREATE TABLE IF NOT EXISTS ingredients (
|
||||||
ingredient_id INTEGER PRIMARY KEY,
|
ingredient_id INTEGER PRIMARY KEY,
|
||||||
ingredient_name VARCHAR(50) NOT NULL UNIQUE,
|
ingredient_name VARCHAR(50) NOT NULL UNIQUE,
|
||||||
preferred_unit VARCHAR(50) NOT NULL CHECK (preferred_unit IN ('g', 'ml'))
|
preferred_unit VARCHAR(50) NOT NULL CHECK (preferred_unit IN ('g', 'ml'))
|
||||||
);
|
);
|
||||||
|
|
||||||
-- What ingredients are in what cookies
|
-- What ingredients are in what cookies?
|
||||||
|
-- Glues together the cookies and ingredients, a 'recipe'.
|
||||||
CREATE TABLE IF NOT EXISTS recipe_contents (
|
CREATE TABLE IF NOT EXISTS recipe_contents (
|
||||||
cookie_id INT NOT NULL,
|
cookie_id INT NOT NULL,
|
||||||
ingredient_id INT NOT NULL,
|
ingredient_id INT NOT NULL,
|
||||||
|
@ -61,6 +63,7 @@ CREATE TABLE IF NOT EXISTS recipe_contents (
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Describes ingredients and stock.
|
-- Describes ingredients and stock.
|
||||||
|
-- This should reference the ingredients table, but we'll keep it simple for now.
|
||||||
CREATE TABLE IF NOT EXISTS raw_materials (
|
CREATE TABLE IF NOT EXISTS raw_materials (
|
||||||
ingredient_id INTEGER PRIMARY KEY,
|
ingredient_id INTEGER PRIMARY KEY,
|
||||||
ingredient_name VARCHAR(50) NOT NULL UNIQUE,
|
ingredient_name VARCHAR(50) NOT NULL UNIQUE,
|
||||||
|
|
Loading…
Add table
Reference in a new issue