-- version: 2
-- SP3 P3 T13: acks table for 999 ACKs. One row per generated/received 999.
CREATE TABLE acks (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    source_batch_id TEXT NOT NULL REFERENCES batches(id) ON DELETE CASCADE,
    accepted_count INTEGER NOT NULL DEFAULT 0,
    rejected_count INTEGER NOT NULL DEFAULT 0,
    received_count INTEGER NOT NULL DEFAULT 0,
    ack_code TEXT NOT NULL,
    parsed_at DATETIME NOT NULL,
    raw_json TEXT
);
CREATE INDEX ix_acks_source_batch_id ON acks(source_batch_id);
