CREATE TABLE IF NOT EXISTS budgets ( id SERIAL PRIMARY KEY, owner_id INTEGER NOT NULL REFERENCES participants(id), category TEXT NOT NULL, month DATE NOT NULL, amount_limit NUMERIC(10,2) NOT NULL, created_at TIMESTAMPTZ DEFAULT NOW(), updated_at TIMESTAMPTZ DEFAULT NOW(), UNIQUE(owner_id, category, month) ); CREATE INDEX IF NOT EXISTS idx_budgets_owner_month ON budgets(owner_id, month);