feat(sp6): migration 0004 — rejection columns + state-history index

Adds:
- claims.rejection_reason, claims.rejected_at, claims.resubmit_count
- claims.state_changed_at (was missing, needed for Done-today lane)
- ix_claims_state_changed_at composite index

Also fixes the ClaimState count assertion in test_db_models.py
(7 → 8) to match the REJECTED enum value added in the previous
commit, and bumps the user_version expectation in test_acks.py
(3 → 4) for the same reason.
This commit is contained in:
Tyler
2026-06-20 18:21:29 -06:00
parent 756196e2a8
commit 1b1534d8d2
3 changed files with 15 additions and 6 deletions
@@ -0,0 +1,9 @@
-- version: 4
-- SP6 T2: 999 rejection tracking + state-history index for the Done-today lane.
ALTER TABLE claims ADD COLUMN rejection_reason TEXT;
ALTER TABLE claims ADD COLUMN rejected_at TIMESTAMP;
ALTER TABLE claims ADD COLUMN resubmit_count INTEGER NOT NULL DEFAULT 0;
ALTER TABLE claims ADD COLUMN state_changed_at TIMESTAMP;
CREATE INDEX ix_claims_state_changed_at ON claims(state, state_changed_at);