14 lines
770 B
SQL
14 lines
770 B
SQL
-- Einkaufsliste (Arbeitspaket 7): Zeilen werden aus dem Plan abgeglichen
|
|
-- (lib/shopping.ts). Zum Gebrauchten kommen Packung und die Gerichte, für die
|
|
-- es gebraucht wird; Grundvorrat steht erst im Vorrats-Check (pantry_state).
|
|
|
|
alter table shopping_items
|
|
add column needed numeric(12, 3),
|
|
add column pack_count integer check (pack_count between 1 and 99),
|
|
add column pack_size numeric(12, 3) check (pack_size > 0),
|
|
add column dishes text[] not null default '{}',
|
|
add column pantry_state text check (pantry_state in ('ask', 'have', 'need'));
|
|
|
|
-- Je Runde und Zutat höchstens eine Zeile aus dem Plan (Freitext beliebig oft).
|
|
create unique index shopping_items_plan_idx on shopping_items (round_id, ingredient_id) where not added_manually;
|