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
+4 -4
View File
@@ -51,16 +51,16 @@ def test_migration_0002_creates_acks_table():
def test_migration_latest_idempotent_on_fresh_db():
"""Re-running the migration on the same DB must be a no-op (PRAGMA
user_version already at the latest version — currently 3 after the
0003 constraint drop was added)."""
user_version already at the latest version — currently 4 after the
0004 rejection columns + state-history index was added by SP6)."""
with db.engine().begin() as c:
v1 = c.exec_driver_sql("PRAGMA user_version").scalar() or 0
assert v1 == 3
assert v1 == 4
# A second run should not raise and should not bump the version.
db_migrate.run(db.engine())
with db.engine().begin() as c:
v2 = c.exec_driver_sql("PRAGMA user_version").scalar() or 0
assert v2 == 3
assert v2 == 4
def test_add_ack_persists_row():