canopy-snap Data Model
For a contributor or maintainer reading the SNAP schema: the tables below are the schema in effect after the migrations listed at the end, applied in order. Only the constraints named CHECK, UNIQUE or EXCLUDE are enforced by the database; the other value sets quoted (status, claim_basis, …) are the service’s or the canopy-overpayments crate’s own vocabulary. Endpoint detail is on the canopy-snap API page; the shared event_outbox / event_inbox pair is described once on the data-models index. Source: migrations/.
Tables
| Table | Purpose |
|---|---|
|
One row per application received from canopy-eligibility: the orchestrator’s |
|
One signed determination per application evaluation: |
|
The immutable ADR-028 input snapshot, one per determination: |
|
Per-determination DEK store for crypto-shred (ADR-036): |
|
Legacy IEVS outcomes |
|
Categorical-eligibility participation (7 CFR 273.2(j)): one row per |
|
Student-exclusion screening (7 CFR 273.5): |
|
ABAWD time-limit state (7 CFR 273.24): the 36-month |
|
A member’s work-registration standing and ABAWD screening as a worker records them (7 CFR 273.7, 273.24; #3218), append-only: |
|
A member's work-sanction findings as a worker records them (7 CFR 273.7(f); #3219): |
|
One row per |
|
An exhausted ABAWD's regaining of eligibility as a worker records it (7 CFR 273.24(d)-(e); #3220): FK |
|
One exempted benefit month of one ABAWD (7 CFR 273.24(g); #3220): |
|
FNS-approved waiver areas (7 CFR 273.24(f)): |
|
The PAMMS 3355 time clock, one row per |
|
Special-situation screenings (7 CFR 273.11(e), (m), (n)): |
|
IEVS income matches, ONE current row per |
|
Self-reported vs IEVS-verified variance, per member: since #2678 |
|
SAVE outcomes only (the raw query stays in canopy-verification, ADR-004): |
|
Transitional SNAP windows on TANF exit (7 CFR 273.26): |
|
The canonical claim table shared by the three program services that stamp it (canopy-snap, canopy-tanf, canopy-medicaid) ( |
|
Repayment schedules per claim: FK |
|
Append-only recoupment events: FK |
|
Append-only principal corrections: FK |
|
Audit + idempotency record of a recompute-from-snapshot (ADR-028 §70): |
|
The pre-establishment claim-floor screen of the claim paths beside the recompute (#2242, |
|
canopy-eligibility’s verdict on each of this service’s determinations, one row per |
|
The shared MQ pair; columns, indexes, parking and retention are on the data-models index. |
Cross-service identifiers (ADR-001 boundary)
Every REFERENCES in the database is drawn above; nothing crosses to another service. Application-level only: household_id / person_id everywhere → canopy-persons; application_id on snap_applications, ievs_match_results, ievs_discrepancies, citizenship_verifications → canopy-applications; ievs_discrepancies.resolved_fact_id → a canopy-persons fact_id; overpayment_claims.determination_id → usually this service’s snap_determinations, unconstrained for back-rebill flows; overpayment_recomputes.claim_id / notice_id → overpayment_claims / canopy-notices, unconstrained; overpayment_claim_screens.claim_id → overpayment_claims, unconstrained, ipv_case_id → a canopy-appeals IPV case, and appeal_id / assessment_id / adverse_action_id → canopy-appeals' appeal and CB assessment and canopy-enrollment’s adverse action; redaction_keys.subject_id → snap_determinations.id by convention.
Retention
canopy-snap does NOT hold FTI. IEVS-sourced wage / UI / SSA-income data is a separate authorization (Social Security Act §1137, 42 USC §1320b-7; 7 CFR 272.8; the SNAP-specific CMA with SSA for the SSA-sourced matches) and lives in ievs_match_results, ievs_discrepancies, and ievs_verification_data — sited in canopy-snap per ADR-004 and never replicated to other services' databases. IEVS retention follows the FNS schedule (3-year minimum for access logs and match results). SNAP record retention proper is 7 CFR 272.1(f): no less than 3 years from the month of origin of each record — fiscal records and accountable documents 3 years from fiscal or administrative closure, (f)(1) (LII mirror, checked 2026-09-19; the eCFR refused this host). The longer of the two governs; archive moves are operator-driven, not migration-driven (ADR-016 forward-only).
Indexes
-
idx_snap_applications_household,idx_snap_applications_application,idx_snap_applications_status -
idx_snap_determinations_application,idx_snap_determinations_household,idx_snap_determinations_status,idx_snap_determinations_determined_at -
idx_snap_determinations_previous_unique— unique(previous_determination_id) WHERE previous_determination_id IS NOT NULL -
idx_snap_determinations_household_created_id—(household_id, created_at DESC, id DESC), the per-household keyset list (#1576) -
snap_determinations_operation_uq— unique(operation_id) WHERE operation_id IS NOT NULL(#788) -
idx_determination_snapshots_as_of—(as_of) -
idx_redaction_keys_subject—(subject_kind, subject_id);uq_redaction_keys_live_subject— unique(subject_kind, subject_id) WHERE shredded_at IS NULL -
idx_ievs_verification_data_person,idx_ievs_verification_data_source -
idx_snap_participations_person,idx_snap_participations_household,idx_snap_participations_program;idx_unique_participation— unique(person_id, program) WHERE active = true -
idx_snap_student_person,idx_snap_student_household -
abawd_tracking_person_active— unique(person_id) WHERE active = true;idx_abawd_tracking_household,idx_abawd_tracking_status -
abawd_activity_month— unique(person_id, benefit_month) -
idx_abawd_clock_person;idx_abawd_clock_person_period— unique(person_id, period_start) -
snap_disqual_screening_household_idx—(household_id, person_id);snap_disqual_screening_type_idx—(screening_type, screening_result) WHERE active = true -
ievs_results_application,ievs_results_person,ievs_results_source;idx_unique_ievs_match— unique(application_id, person_id, match_source) -
ievs_discrepancies_application,ievs_discrepancies_person;ievs_discrepancies_status—(resolution_status) WHERE resolution_status = 'pending' -
idx_citizenship_verification_application,idx_citizenship_verification_person -
idx_tsnap_household,idx_tsnap_end_date -
overpayment_claims_status;overpayment_claims_keyset—(created_at DESC, id DESC);overpayment_claims_assessment_once— unique(assessment_id) WHERE assessment_id IS NOT NULL;overpayment_claims_source_event_once— unique(source_event_id) WHERE source_event_id IS NOT NULL;overpayment_claims_by_appeal—(appeal_id) WHERE appeal_id IS NOT NULL -
repayment_plans_by_claim,recoupment_ledger_by_claim,claim_adjustments_by_claim -
idx_overpayment_recomputes_household_period—(household_id, covered_period_start, covered_period_end), the overlap guard -
overpayment_recomputes_window_once— unique(baseline_determination_id, covered_period_start), the idempotency key (#2243) -
overpayment_claim_screens_pending—(created_at, id) WHERE outcome = 'pending', the claim-screen pass’s drain order;overpayment_claim_screens_household—(household_id);overpayment_claim_screens_assessment_once— unique(assessment_id) WHERE assessment_id IS NOT NULL, how a re-emitted assessment finds its screen -
event_outbox_*,event_inbox_unprocessed_idx,idx_event_inbox_parked— the generated partial indexes, described on the data-models index
Migration files
-
20260326000000_create_snap_tables.sql—snap_applications,snap_determinations,ievs_verification_data -
20260328000000_create_snap_categorical.sql—snap_program_participations,snap_student_status -
20260329000000_create_abawd_tables.sql—abawd_tracking,abawd_monthly_activity,abawd_discretionary_exemptions,abawd_discretionary_exemption_grants,abawd_waiver_areas -
20260329000001_create_disqualification_screenings.sql—snap_disqualification_screenings -
20260330000000_create_ievs_tables.sql—ievs_match_results,ievs_discrepancies -
20260330000001_create_citizenship_verification.sql—citizenship_verifications -
20260402000000_add_constraints.sql—idx_unique_participation,idx_unique_ievs_match -
20260407000000_create_abawd_time_clock.sql—abawd_time_clock -
20260414000000_create_tsnap_certifications.sql—snap_tsnap_certifications -
20260508000000_create_event_outbox.sql— generated (index page) -
20260510000001_create_overpayments.sql—overpayment_claims,repayment_plans,recoupment_ledger -
20260516000000_create_event_inbox.sql— generated (index page) -
20260518004851_event_outbox_lease_columns.sql— generated (index page) -
20260620000000_add_discrepancy_resolved_by_sub.sql—ievs_discrepancies.resolved_by_sub(#677) -
20260621000000_create_determination_snapshots.sql—snap_determinations.snapshot_hash,determination_snapshots, its append-only trigger (#678, ADR-028) -
20260622000000_add_previous_determination_id.sql—snap_determinations.previous_determination_idself-FK +idx_snap_determinations_previous_unique(#683) -
20260624140000_create_redaction_keys.sql—redaction_keysand its one-way guard triggers (ADR-036) -
20260627000000_create_overpayment_recomputes.sql—overpayment_recomputes(#681) -
20260630000000_add_ievs_resolved_fact_id.sql—ievs_discrepancies.resolved_fact_id(#876) -
20260713000000_event_outbox_hold.sql— generated (index page) -
20260720000000_event_inbox_parking.sql— generated (index page) -
20260727000000_claim_provenance_adjustments.sql— claim provenance columns, the void path,claim_adjustments(#1104; canonical copy incrates/canopy-overpayments/migrations/) -
20260803000000_event_outbox_v7_pk_default.sql— generated (index page) -
20260804000000_v7_pk_defaults.sql— drops thegen_random_uuid()default onsnap_tsnap_certifications.id(#1173) -
20260807000000_overpayments_v7_pk_defaults.sql— drops the id defaults on the four overpayment tables (#1173) -
20260810000000_snapshot_hash_not_null.sql— deletes pre-snapshot determinations and setssnapshot_hash NOT NULL(#911) -
20260815000000_event_outbox_claim_order_idx.sql— generated (index page) -
20260902000000_overpayment_claims_keyset_idx.sql—overpayment_claims_keyset(#1222) -
20260904000000_event_outbox_parking.sql— generated (index page) -
20261121000000_snap_determinations_trigger.sql—snap_determinations.triggerwith its CHECK (#1213) -
20261206000000_snap_determinations_household_idx.sql—idx_snap_determinations_household_created_id(#1576) -
20261208000000_redaction_keys_live_subject_uq.sql— tombstones superseded live DEKs, thenuq_redaction_keys_live_subject(#1458) -
20261209000000_uprov_b_snap_provenance.sql—effective_date_basis,benefit_effective_date,operation_id+snap_determinations_operation_uq(#788) -
20261223000000_snap_program_extension.sql—snap_determinations.program_extension(#1662) -
20261224000000_redaction_keys_rewrap_guard.sql—canopy_redaction_keys_one_way_guard()admits the KEK rewrap (wrapped_dekreplaced +kek_versionstrictly increased on a live row) beside the shred (#2113) -
20270111000000_snap_determinations_signed_payload.sql— a delete cutover (#1984, after #911): inside thecanopy.snapshot_maintenancewindow it clearsdetermination_snapshotsand everysnap_determinationsrow (supersession pointers nulled first — no existing row carries the bytes it was signed with; devstacks refill through the reseed), then addssigned_payload BYTEA NOT NULL -
20270111000001_determination_status_check.sql— deletes any row outsideapproved / denied / sanctioned, every determination that supersedes it (directly or transitively) and their snapshots, inside thecanopy.snapshot_maintenancewindow, then addssnap_determinations_status_verdict(#628) -
20270113000001_overpayment_discovered_by_actor.sql— the canonical stamp (crates/canopy-overpayments/migrations/canonical_discovered_by_actor.sql):overpayment_claims.discovered_bybecomesTEXT+discovered_by_service; a guard aborts namingcargo xtask dev restarton any existing claim (none states a provable actor of a known class: NULL, nil, a body-supplied subject, or a recompute requester that may be a service account’s subject); thenoverpayment_claims_discovered_by_one_actor(= 1, VALID) (#1008) -
20270113000002_snap_actor_subjects.sql—overpayment_recomputes.requested_bybecomesTEXT(DROP NOT NULL) +requested_by_service;ievs_discrepanciesdrops the UUIDresolved_by, renamesresolved_by_subtoresolved_byand addsresolved_by_service;abawd_discretionary_exemption_grants.granted_byandsnap_disqualification_screenings.screened_bybecomeTEXT; a guard aborts namingcargo xtask dev restarton any existing recompute or resolved discrepancy (their stored subject may be a service account’s, indistinguishable from a worker’s) and on a nilgranted_by/screened_by; then the pair CHECKs, VALID (#1008) -
20270114000000_overpayment_recompute_verdicts.sql— a guard aborts namingcargo xtask dev restarton any existing recompute (its verdict statuses were never recorded, and the cents cannot recover them); thenoverpayment_recomputes.baseline_status(NOT NULL) +correct_statuswithoverpayment_recomputes_baseline_status_verdict,overpayment_recomputes_correct_status_verdictandoverpayment_recomputes_correct_status_iff_sized(#2325) -
20270114000001_overpayment_recompute_request_terms.sql— a guard aborts namingcargo xtask dev restarton any recompute missingclaim_basisordiscovered_in_qc_review(a no-claim row never recorded the request’s basis); then both columnsSET NOT NULL(#2243) -
20270114000002_overpayment_claim_screens.sql—overpayment_claim_screenswith its CHECKs and the three indexes (#2242) -
20270114000003_overpayment_recompute_outcome_check.sql—overpayment_recomputes_outcome_recorded, VALID (#2440) -
20270114000004_overpayment_recompute_window_key.sql— a guard aborts namingcargo xtask dev restartwhen two recomputes share a determination and window start; then dropsUNIQUE (baseline_determination_id, correction_as_of)(implied by the new key) and addsoverpayment_recomputes_window_once(#2243) -
20270117000000_redaction_keys_created_at_no_default.sql— drops theredaction_keys.created_atdefault: the shared canopy-db store bindscreated_at(the determination’s decision instant) andshredded_at(the redaction’s) from its caller, so an insert that names nocreated_atnow fails instead of taking the database clock (#2475) -
20270118000000_overpayment_stamps_no_default.sql— the canonical stamp (crates/canopy-overpayments/migrations/canonical_stamps_no_default.sql): drops thenow()defaults ofoverpayment_claims.created_at/updated_at,repayment_plans.created_at/updated_at,recoupment_ledger.occurred_atandclaim_adjustments.created_at— the shared store binds every stamp from the writing request’s decision clock, so an insert that names no stamp now fails instead of taking the database clock (#2576) -
20270411000000_overpayment_claim_period.sql— the canonical stamp (crates/canopy-overpayments/migrations/canonical_claim_period.sql):overpayment_claims.period_first_month/period_last_month, nullable, withoverpayment_claims_period_whole_months(#3567) -
20270411000001_snap_claims_require_period.sql— SNAP only:overpayment_claims_snap_period_required, and the two NOT NULL period columns ofoverpayment_claim_screenswith their CHECK. It fails on a database holding any claim or screen row, since the months cannot be derived: re-seed (#3567) -
20270119000000_ievs_discrepancy_withdrawn.sql—ievs_discrepancies.withdrawn_at(TIMESTAMPTZ, nullable) withievs_discrepancies_withdrawn_iff_stamped(resolution_status = 'withdrawn'exactly whenwithdrawn_atis set) andievs_discrepancies_withdrawn_never_resolved; additive, VALID on every existing row (none is withdrawn): a verification re-run withdraws a discrepancy it no longer finds by status, never a delete (#2665) -
20270209000000_decision_stamps_no_default.sql— drops the defaults of every stamp the service’s production INSERTs bind themselves:snap_applications.created_at,snap_determinations.created_at,determination_snapshots.created_at,snap_tsnap_certifications.created_at/updated_at,overpayment_recomputes.created_atandoverpayment_claim_screens.created_at. An insert that names no stamp now fails instead of taking the database clock, andcargo xtask migrations-lintrefuses a new clock default (#2589) -
20270215000000_determination_verdicts.sql— thedetermination_verdictstable and itsverdictCHECK (#2322) -
20270322000000_snap_abawd_discretionary_exemptions.sql—snap_abawd_discretionary_exemptionswith its CHECKs and indexes (#3220) -
20270322000001_snap_abawd_regains.sql—snap_abawd_regainswith its CHECKs and index (#3220) -
20270322000002_drop_writerless_abawd_pool_tables.sql— dropsabawd_discretionary_exemption_grantsandabawd_discretionary_exemptions, which nothing wrote;snap_abawd_discretionary_exemptionsreplaced them (#3235) -
20270324000000_determination_status_withheld.sql— ADR-052: replacessnap_determinations_status_verdictand the twooverpayment_recomputes_*_status_verdictconstraints so the list also admitswithheld; no row is rewritten.
The eight generated files are byte-identical copies of crates/canopy-mq/outbox-migrations/ (the data-models index). All migrations are forward-only per ADR-016.
20260326000000_create_snap_tables.sql (its header comment and the comment above ievs_verification_data) and 20260330000000_create_ievs_tables.sql (its second line) cite "7 USC §2025(e)" as the statute restricting IEVS data to SNAP. That cite is superseded: §2025(e) is the SSN section; the IEVS mandate is Social Security Act §1137 (42 USC §1320b-7), the use restriction on IEVS-received data is §1320b-7(a)(5), and 7 USC §2020(e)(8) is the SNAP disclosure safeguard — ADR-004 Amendment 6 (#2129), the legal_basis that compliance/data-tenancy-authorisation.toml [class.ievs] carries. An applied migration is immutable, so the header text stands as written; the siting the headers describe (IEVS tables in canopy-snap’s own database, per ADR-004) is unchanged.