chore(db): Migration 013 fuer Einkaufsliste-Tabellen
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 2m20s
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 2m20s
This commit is contained in:
18
src/lib/server/db/migrations/013_shopping_list.sql
Normal file
18
src/lib/server/db/migrations/013_shopping_list.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- Einkaufsliste: haushaltsweit geteilt. shopping_cart_recipe haelt die
|
||||
-- Rezepte im Wagen (inkl. gewuenschter Portionsgroesse), shopping_cart_check
|
||||
-- die abgehakten aggregierten Zutaten-Zeilen. Aggregation wird bei jedem
|
||||
-- Read aus shopping_cart_recipe JOIN ingredient derived — nichts
|
||||
-- materialisiert, damit Rezept-Edits live durchschlagen.
|
||||
CREATE TABLE shopping_cart_recipe (
|
||||
recipe_id INTEGER PRIMARY KEY REFERENCES recipe(id) ON DELETE CASCADE,
|
||||
servings INTEGER NOT NULL CHECK (servings > 0),
|
||||
added_by_profile_id INTEGER REFERENCES profile(id) ON DELETE SET NULL,
|
||||
added_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE shopping_cart_check (
|
||||
name_key TEXT NOT NULL,
|
||||
unit_key TEXT NOT NULL,
|
||||
checked_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (name_key, unit_key)
|
||||
);
|
||||
Reference in New Issue
Block a user