openvibers/openvibe.finance migrations0003_budgets.sql

0003_budgets.sql

main 582 B · 12 lines · sql

1-- phase: expand
2-- Budgets (plan §L.2: "budgets (envelope, category, flex, paycheck, none)"), the category kind first: a monthly limit
3-- for a category of spending, the same every month until changed. The month page sets the limit against what the
4-- category spent. A person with no budgets has none (the "none" kind): nothing nags.
5CREATE TABLE finance_budgets (
6 owner text COLLATE "C" NOT NULL,
7 category text NOT NULL,
8 monthly_cents bigint NOT NULL CHECK (monthly_cents > 0),
9 updated_at timestamptz NOT NULL DEFAULT now(),
10 PRIMARY KEY (owner, category)
11);
12