CREATE TABLE IF NOT EXISTS health_budget_state (
    id              INTEGER PRIMARY KEY AUTOINCREMENT,
    budget_name     TEXT NOT NULL,
    period_start    INTEGER NOT NULL,
    period_end      INTEGER NOT NULL,
    consumed        REAL NOT NULL DEFAULT 0,
    capacity        REAL NOT NULL,
    last_updated_at INTEGER NOT NULL,
    UNIQUE(budget_name, period_start)
);
CREATE INDEX IF NOT EXISTS idx_budget_state_active
    ON health_budget_state(budget_name, period_end DESC);
