dodil/erp-brick-expenses

DODIL ERP brick: expenses

src/brick_expenses/migrations/00006_receipts/up.sql

-- 00006_receipts - slice B item 4: the receipt store (EXP-01, EXP-16): one row per stored image under its content-addressed key, and the line's
-- possible-duplicate mark. Additive only. ADD COLUMN is DISRUPTIVE on DataK3: migrate the test copy first, the live one at a quiet hour.

ALTER TABLE exp_line ADD COLUMN possible_duplicate_of VARCHAR;

CREATE TABLE IF NOT EXISTS exp_receipt_image (
    object_key             VARCHAR NOT NULL,
    report_id              VARCHAR,
    line_no                INTEGER,
    sha256                 VARCHAR,
    content_type           VARCHAR,
    size_bytes             INTEGER,
    uploaded_by            VARCHAR,
    uploaded_at            TIMESTAMP,
    retain_until           DATE,
    possible_duplicate_of  VARCHAR,
    created_at             TIMESTAMP,
    updated_at             TIMESTAMP,
    PRIMARY KEY (object_key)
);