aboutsummaryrefslogtreecommitdiffstats
path: root/crates/rocie-server/src/storage/migrate
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-02-15 22:24:32 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-02-15 22:25:06 +0100
commite5f90f4474cb96a78080395980283e4b2ce40214 (patch)
treecaac3300795eae8e4cb1ee3c1c4bf85cd5950402 /crates/rocie-server/src/storage/migrate
parentchore(treewide): Update (diff)
downloadserver-e5f90f4474cb96a78080395980283e4b2ce40214.zip
feat(treewide): Add recipes and user handling
Diffstat (limited to 'crates/rocie-server/src/storage/migrate')
-rw-r--r--crates/rocie-server/src/storage/migrate/sql/0->1.sql28
1 files changed, 21 insertions, 7 deletions
diff --git a/crates/rocie-server/src/storage/migrate/sql/0->1.sql b/crates/rocie-server/src/storage/migrate/sql/0->1.sql
index e3dd879..ba44c68 100644
--- a/crates/rocie-server/src/storage/migrate/sql/0->1.sql
+++ b/crates/rocie-server/src/storage/migrate/sql/0->1.sql
@@ -14,17 +14,29 @@ CREATE TABLE version (
valid_to INTEGER UNIQUE CHECK (valid_to > valid_from)
) STRICT;
--- Encodes the tree structure of the products.
--- A parent cannot be a product, but can have parents on it's own.
+-- Encodes the tree structure of the product parents.
+-- A product parent cannot be a product, but can have parents on it's own.
-- TODO: Fix the possibility for cyclic parent-ship entries <2025-09-05>
-CREATE TABLE parents (
+CREATE TABLE product_parents (
id TEXT UNIQUE NOT NULL PRIMARY KEY,
parent TEXT DEFAULT NULL CHECK (
id IS NOT parent
),
name TEXT UNIQUE NOT NULL,
description TEXT,
- FOREIGN KEY(parent) REFERENCES parents(id)
+ FOREIGN KEY(parent) REFERENCES product_parents(id)
+) STRICT;
+
+-- Encodes the tree structure of the recipe parents.
+-- TODO: Fix the possibility for cyclic parent-ship entries <2025-09-05>
+CREATE TABLE recipe_parents (
+ id TEXT UNIQUE NOT NULL PRIMARY KEY,
+ parent TEXT DEFAULT NULL CHECK (
+ id IS NOT parent
+ ),
+ name TEXT UNIQUE NOT NULL,
+ description TEXT,
+ FOREIGN KEY(parent) REFERENCES recipe_parents(id)
) STRICT;
-- Stores the registered users.
@@ -71,7 +83,7 @@ CREATE TABLE products (
description TEXT,
parent TEXT DEFAULT NULL,
unit_property TEXT NOT NULL,
- FOREIGN KEY(parent) REFERENCES parents(id),
+ FOREIGN KEY(parent) REFERENCES product_parents(id),
FOREIGN KEY(unit_property) REFERENCES unit_properties(id)
) STRICT;
@@ -123,8 +135,10 @@ CREATE TABLE unit_properties (
CREATE TABLE recipies (
id TEXT UNIQUE NOT NULL PRIMARY KEY,
- path TEXT UNIQUE NOT NULL,
- content TEXT NOT NULL
+ name TEXT UNIQUE NOT NULL,
+ parent TEXT,
+ content TEXT NOT NULL,
+ FOREIGN KEY(parent) REFERENCES recipe_parents(id)
) STRICT;
-- Encodes unit conversions: