dodil/erp-brick-expenses
DODIL ERP brick: expenses
src/brick_expenses/migrations/00008_ai/up.sql
-- 00008_ai - slice B item 5: the receipt reader's consent and audit (EXP-01, EXP-02): an employee's yes or no per AI step (append-only) and what the model
-- read from each receipt with what the person did with each field. Additive only.
CREATE TABLE IF NOT EXISTS exp_consent (
person_id BIGINT NOT NULL,
step_key VARCHAR NOT NULL,
given_at TIMESTAMP NOT NULL,
decision VARCHAR,
text_version VARCHAR,
created_at TIMESTAMP,
updated_at TIMESTAMP,
PRIMARY KEY (person_id, step_key, given_at)
);
CREATE TABLE IF NOT EXISTS exp_ai_finding (
report_id VARCHAR NOT NULL,
line_no INTEGER NOT NULL,
finding_no INTEGER NOT NULL,
step_key VARCHAR,
model VARCHAR,
inputs_digest VARCHAR,
fields_json VARCHAR,
confirmed_json VARCHAR,
decided_by VARCHAR,
decided_at TIMESTAMP,
created_at TIMESTAMP,
updated_at TIMESTAMP,
PRIMARY KEY (report_id, line_no, finding_no)
);