Some more cleaning in tables

This commit is contained in:
Imbus 2024-05-05 11:52:55 +02:00
parent 72d0380023
commit 1969d2f98f

View file

@ -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
-- of volume or weight instead. Here we choose
-- 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 (
ingredient_id INTEGER PRIMARY KEY,
ingredient_name VARCHAR(50) NOT NULL UNIQUE,
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 (
cookie_id INT NOT NULL,
ingredient_id INT NOT NULL,
@ -61,6 +63,7 @@ CREATE TABLE IF NOT EXISTS recipe_contents (
);
-- 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 (
ingredient_id INTEGER PRIMARY KEY,
ingredient_name VARCHAR(50) NOT NULL UNIQUE,