From 1969d2f98f1195ef653eb77ba9de3f94a63e8e65 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Sun, 5 May 2024 11:52:55 +0200 Subject: [PATCH] Some more cleaning in tables --- app/Migrations/create-schema.sql | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Migrations/create-schema.sql b/app/Migrations/create-schema.sql index 5c6664a..57c565d 100644 --- a/app/Migrations/create-schema.sql +++ b/app/Migrations/create-schema.sql @@ -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,