canopy-eligibility Data Model

Tables

Table Purpose

eligibility_requests

Root orchestration record. One row per cross-program eligibility run, keyed by (application_id, household_id) with the programs_requested text array (which program services to dispatch to). requested_by is the identity the request body names (DetermineRequest.requested_by, stored as supplied, not read from the bearer), and a bulk run’s system:cola-redetermination:<run id> (bulk/admission.rs); requested_at / completed_at bound the run. status is constrained by eligibility_requests_status_check to the closed set pending / in_progress / completed / failed (migration 20260402000000). An interactive or order run’s admission inserts the row in_progress (#2667); a bulk admission inserts it pending, and the bulk arm moves it to in_progress. The idx_unique_pending_request partial unique index prevents two concurrent in-flight runs for the same (application, household). Since #1213 the row also carries the bulk pair bulk_case_id / bulk_program_epoch (both-or-neither CHECK eligibility_requests_bulk_pair; idx_unique_pending_bulk_case holds one live request per cohort case) and since #1504 the correlation pair origin_source / origin_ref (both-or-neither CHECK eligibility_requests_origin_pair + the partial idx_eligibility_requests_origin).

program_determinations

The determinations of record (ADR-002 Amendment 5): one row per program envelope whose signature verified and that bound to its dispatch; eligibility_request_id FKs to eligibility_requests(id). Stores the verified envelope, never raw program data (ADR-002). program, eligibility_request_id, application_id and household_id are canopy-eligibility’s own routing (the request and program it dispatched, or the bulk case; a chip dispatch’s envelope claims chip and verifies under canopy-medicaid’s medicaid key, ADR-002 Amendment 6); the signed columns are the envelope’s: status (CHECK program_determinations_status_verdict: approved / denied / sanctioned / withheld, #628), benefit_amount / benefit_unit, the effective_date / expiration_date / renewal_date window, basis, program_service_version, determined_at, the JWS signature, person_id (ADR-035 Slice 1, NULL = household-level subject) under program_determinations_request_program_subject_uniq, and the provenance columns, each NULL when the envelope carried no value: trigger and policy_target (#1213), evaluated_as_of (#1479), effective_date_basis / operation_id (#788; unique per subject where not null, program_determinations_operation_subject_uq below), program_extension (#1709 — the envelope’s program-specific payload as signed; the orchestrator never reads it), snapshot_hash (TEXT NOT NULL since #1764 — the ADR-028 input-snapshot hash the signature covers), denial_reason_codes and previous_determination_id (#1764; absent and empty are distinct signed values), and advisories (#3324, ADR-002 Amendment 9: the envelope's operator advisories as signed JSON; NULL = none), and config_stamp (JSONB NOT NULL, #3261, ADR-002 Amendment 10: the configuration the program ran on, a non-empty array of { name, sha }, one per layer, lowest precedence first; sha is a 40-hex commit, or path for an unverified working copy). signed_payload BYTEA NOT NULL (#2061) is the exact RFC 8785 bytes (SignableDetermination::canonical_signing_payload()) the signature verified over; the orchestrator inserts a row only when its columns, as the INSERT returns them, re-canonicalize to those bytes, so a row re-verifies from itself alone — the reconstructability promise of ADR-028. benefit_effective_date (#788) is not a signed field: it is the dispatch’s anchor (the cohort case’s on the bulk arm, the operation claim’s on a reverify promotion), recorded only when the envelope signed an effective_date_basis. received_at / created_at are eligibility’s stamps. A bulk-ADOPTED row (D-2c) is the successor envelope canopy-snap signed, recorded from the bytes its envelope read returned. The demo seed inserts rows whose signatures it computes over their own signed_payload with each program’s devstack key (the key the program service registers), so a seeded row verifies like any other (#2320). The header of 20270111000000_quarantined_determinations.sql still names the seed’s placeholder rows as the exception; that migration is applied and checksummed, so its comment stays (ADR-016).

quarantined_determinations (#2061)

One row per envelope the orchestrator did not record: its signature did not verify, or it verified and did not bind (the claimed program, application or household differs from the dispatch, a SNAP/TANF envelope names a subject, a Medicaid or CHIP envelope does not sign the dispatch’s claimed operation, or on the bulk arm the case’s supersession link or the run’s pins differ). id is minted by canopy-eligibility (UUID v7 CHECK), never the claimed id; eligibility_request_id FKs to eligibility_requests(id); program, application_id and household_id are the trusted routing. owner CHECK interactive / order / bulk names whose ledger owns the envelope (only interactive envelopes are resolvable by operators). claimed_determination_id is the id the envelope claims (for D-2c bytes that do not parse as an envelope, the id they were fetched under) and is deliberately NOT unique (a re-landed quarantine records a new row; a verified re-land inserts the determination of record under that id without colliding here). signed_payload BYTEA NOT NULL and signature are stored as received; apart from claimed_determination_id, every claimed value lives only in those bytes. quarantine_reason CHECK signature_malformed / key_unknown / key_unavailable / signature_invalid / provenance_rejected (QuarantineReason); a failed reverify rewrites it. revision INT NOT NULL DEFAULT 0 is the compare-and-set counter resolutions serialize on; received_at. dispatched_operation_id UUID NULL (#2319) is the operation the dispatch claimed, which a reverify binds a Medicaid or CHIP envelope to; NULL when the dispatch claimed none, or on a row written before #2319, whose Medicaid or CHIP envelope then fails reverify provenance_rejected. The table has no state column: state is derived from quarantine_resolutions and the determinations of record (reverified, dismissed, superseded, otherwise open). Each insert increments canopy_eligibility_determinations_quarantined_total{program,reason}.

quarantine_resolutions (#2061)

The append-only operator ledger over quarantined_determinations: one row per reverify or dismiss, written in the same transaction as the envelope’s revision compare-and-set. id (UUID v7 CHECK); quarantined_id FKs to quarantined_determinations(id); revision is the envelope’s revision after this resolution. action CHECK reverify / dismiss; reason_before (NOT NULL) and reason_after (NULL exactly when a reverify verified and bound), both CHECK over the five QuarantineReason tokens; determination_id names the determination of record a successful reverify promoted. actor is the operator bearer’s verified attribution subject, authz_basis the operator role that admitted it (role:admin, role:supervisor, role:eligibility_specialist), note the trimmed note (1–500 characters, checked by the service); created_at. CHECKs: quarantine_resolutions_dismiss_keeps_reason (a dismiss keeps the reason — reason_after IS NOT DISTINCT FROM reason_before, NULL-safe — and names no determination) and quarantine_resolutions_reverify_promotes_when_cleared (a reverify names a determination exactly when it cleared the reason); quarantine_resolutions_one_per_revision UNIQUE (quarantined_id, revision). The statement-level trigger quarantine_resolutions_append_only (quarantine_resolutions_append_only_guard()) refuses UPDATE and DELETE always, and TRUNCATE unless the transaction set canopy.audit_maintenance = 'on' (the eligibility seed script opens it).

held_determination_resolutions (#3065)

The append-only operator ledger over determinations whose completion events a program service holds because canopy-eligibility never recorded them (ADR-002 Amendment 8): one row per adopt or drop, written in the transaction that stages its verdict (an adopt’s determination.recorded.<program>, a drop’s determination.disowned.<program>) and its determination.held_resolved event. id (UUID v7 CHECK); action CHECK adopt / drop; program CHECK over the six slugs (the program as its service reported it); determination_id UUID NOT NULL UNIQUE, so a determination is resolved once; operation_id and eligibility_request_id, the operation and request an adopt recorded under. actor, authz_basis and note as on quarantine_resolutions; created_at bound from the request’s decision clock, no default (#2589). CHECK held_determination_resolutions_adopt_names_its_order: an adopt names both the operation and the request, a drop names neither. A drop row makes its id unrecordable: store::record_determination_on takes the advisory lock (3065, hashtext(determination_id)) and refuses it. The statement-level trigger held_determination_resolutions_append_only refuses UPDATE and DELETE always, and TRUNCATE unless the transaction set canopy.audit_maintenance = 'on' (the eligibility seed script names the table in its TRUNCATE).

determination_operations

The #788 claim ledger for the interactive/order arms: one row per claimed (application_id, program) dispatch — v7 id (the operation id signed into the envelope), monotonic generation, the claimed effective_date_basis + benefit_effective_date, claimed_at, the CAS settle pair settled_at / outcome (both-or-neither CHECK), and eligibility_request_id (#3065), the request of the run that claimed it: a pinned claim’s re-open overwrites it, so it names the newest execution’s request, the one a held adoption records on; NULL for a row claimed before migration 20270302000000. determination_operations_open_uq (partial unique WHERE settled_at IS NULL) enforces ONE open claim per pair; a concurrent second claim refuses the whole run 409, and an abandoned claim (crash between claim and settle) is reaped abandoned by the next claim once older than the request-staleness TTL. The #1213 bulk path deliberately does NOT use this table — it mints its operation id write-once inside the cohort-case CAS claim.

determination_order_operations (#2652)

One claimed determination operation per order epoch and program, on the order ledger: operation_id (v7, the PK — minted on the epoch’s first execution), origin_source / origin_ref (the order’s origin, the identity determination_orders is UNIQUE on), program_epoch, program (the lowercase claim token), created_at; determination_order_operations_epoch_uq UNIQUE (origin_source, origin_ref, program_epoch, program). Every re-execution of the epoch reads its row back and claims that operation in determination_operations, so it dispatches the operation (and, with an unchanged context, the body) its deterministic Idempotency-Key was first sent with; a new epoch mints new rows. Migration 20270113000000_determination_order_operations.sql.

determination_orders (#1504)

The durable single-case order substrate — ADR-002 Amendment 1’s Order arm (#575). One row per requester-identified async determination order; UNIQUE (origin_source, origin_ref) is the durable dedup identity (a redelivered or duplicate determination.requested::Order converges on the same row). state is CHECK-constrained to pending / dispatched / succeeded / failed_terminal / failed_retryable; program_epoch, attempt_count, next_attempt_at and attempt_started_at carry the attempt accounting (the claim column itself fences concurrent consumers — no cohort_cases-style generation fencing); eligibility_request_id links the run the order settled on, the newest run that answered one of its programs with a verdict and no pending result for it (on a multi-program order, earlier runs may have answered the others, #2688; a per-person run with a member still pending answers nothing, #3012); last_error_code / last_error_excerpt record the last failure; subject_person_id and subject_sanction_ref (UUIDs, nullable; #3219, 20270321000000_determination_orders_subject.sql) are the member and the canopy-snap finding a work-sanction order is about, carried into the order self-call and the work_sanction basis. Served by determination_orders_due_idx (partial — due, unclaimed, non-terminal: the sweep scan) and determination_orders_claimed_idx (partial WHERE attempt_started_at IS NOT NULL: the stale-claim re-arm scan). Migration 20261125000000_determination_orders.sql, which also adds the origin_source / origin_ref correlation pair (both-or-neither CHECK + partial index) to eligibility_requests.

combined_results

Assembled cross-program result for one run. One row per eligibility_request_id (FK to eligibility_requests(id)). Rolls up the per-program verdicts into the programs_approved / programs_denied / programs_pending text arrays (each defaulting to '{}'), carries the EE15-propagated medicaid_assigned_group, the total_monthly_benefit sum, and assembled_at. This is the worker-facing combined view the orchestrator returns after all program dispatches resolve.

cohort_runs

One row per bulk run: state machine (materializing → previewing → previewed → enacting → completed*, plus paused/canceling/canceled/failed), the frozen expected_policy_target, the frozen expected_config_stamp (JSONB NOT NULL, #3261: the configuration canopy-snap ran on at creation, the same shape as program_determinations.config_stamp; migration 20270323000000_program_determinations_config_stamp.sql adds both columns and empties the determination, cohort, quarantine and held-resolution tables, since no stored envelope was signed with a stamp), canary + breaker watermark, deadline, principals. A constant-expression partial unique index holds the fleet to ONE active run. Immortal. Since #806 also excluded_expedited (migration 20270107000000_cohort_runs_excluded_expedited.sql): the universe rows NOT admitted as cases because their certification is expedited, bumped in the same transaction as the materialize cursor’s CAS advance, so count(cohort_cases) + excluded_expedited = universe_row_count once materialized.

cohort_cases

One row per cohort member: dispatch_generation (delivery fence) vs program_epoch (logical execution epoch — the idempotency-key input), the frozen pair (request_body write-once, frozen_context per epoch), attempt/yield counters, preview verdicts (preview_baseline_status / preview_target_status, nullable, each CHECK-closed to approved / denied / sanctioned / withheld since #628 — cohort_cases_preview_baseline_status_verdict, cohort_cases_preview_target_status_verdict), successor_determination_id for skips. Since #788 also the provenance trio, each write-once: operation_id (minted inside claim_attempt, the consumer’s CAS claim) and, since #806, effective_date_basis = mass_change_cola { certification_start_date, certification_end_date } — the household’s live certification period the consumer’s per-case enrollment read returned at the run’s as_of — with benefit_effective_date = the run’s mass-change effective date, both stamped by freeze_provenance after that read (NULL until a claim’s read finds a live row), so re-arms keep the first freeze, a moved period is detected at enact (certification_changed_since_preview) rather than overwritten, and the frozen context replays byte-identically. Reaped after retention.

cohort_case_results

THE durable ledger: UNIQUE (case_id, program, program_epoch), inserted in the SAME transaction as the program_determinations row, whose determination_id the insert returns and the arm compares (a different one is EnvelopeConflict, ledger_holds_another_determination); status keeps its approved / denied CHECK; adopted marks D-2c recoveries — since #1984 only a successor whose signed bytes, read from canopy-snap, verified and bound. Recovery reads this, never request status.

cohort_case_attempts

Append-only attempt audit: real attempts carry a partial-unique ordinal per (case, phase, generation); yields and late-dropped settles ride ordinal-free. Feeds the failure-rate breaker window.

cohort_run_actions

The operator ledger: actor, actual privilege, reason, from/to states, typed detail. Immortal. A row commits in the transaction that makes the transition it records (#3242).

event_outbox, event_inbox

The generated ADR-018 / ADR-039 outbox and the generated consumer inbox, single-sourced in crates/canopy-mq/outbox-migrations/ — schema, indexes and migration files are described once in the data-models index. canopy-eligibility both publishes and subscribes (canopy_mq::Subscriber in services/canopy-eligibility/src/bulk/consumer.rs), so event_inbox is live here.

idempotency_keys

The fleet-wide idempotent-POST cache (#434 / #1463), created outside this service’s migrations/ directory and described once in the data-models index.

Relationships

Intra-database foreign keys only (relationship-only; columns live in the Tables list):

Diagram

determination_orders, determination_order_operations and determination_operations carry no FK (determination_order_operations keys by the order’s origin and links to determination_operations.id by value): determination_orders.eligibility_request_id links the admitted run, and cohort_case_results.determination_id / program_determinations.operation_id / quarantine_resolutions.determination_id / held_determination_resolutions.determination_id link across tables by value only (migrations 20261120000000, 20261125000000, 20261204000000, 20270112000000, 20270301000000).

Cross-service FKs (ADR-001 boundary)

Per ADR-001 no foreign key crosses a service boundary; the only DB-level FKs are the intra-database ones drawn above. Every UUID that points outside canopy_eligibility — application_id (canopy-applications) and household_id (canopy-persons) on eligibility_requests, program_determinations, quarantined_determinations, combined_results, cohort_cases and determination_orders, person_id on program_determinations, and the origin_ref / successor_determination_id correlation ids — is an application-level reference: canopy-eligibility trusts the caller and the BFFs to supply real IDs but does not enforce existence. Per ADR-002 the orchestrator never persists raw program inputs: program_determinations stores only each program service’s signed, JWS-verified determination envelope, and quarantined_determinations only the signed bytes of an envelope it refused.

Retention

Retention floors (eCFR, checked 2026-09-16): canopy-eligibility holds no FTI or PHI — the envelopes it persists are program outputs (ADR-002), so the Pub 1075 / HIPAA floors live with the program services (canopy-tanf, canopy-medicaid). The program floors that govern the envelopes: SNAP program records no less than 3 years from the month of origin of each record (7 CFR 272.1(f)); Medicaid the active case plus a minimum of 3 years (42 CFR 431.17(c)(1)) and fiscal records 3 years from submission of the final expenditure report, longer while audit findings are unresolved (42 CFR 433.32(b)–(c)); TANF has no program-specific retention section — the HHS award-record floor is 3 years from the final financial report (2 CFR 200.334, applied to HHS awards by 2 CFR 300.1; 45 CFR part 75 was removed effective 2025-10-01, 89 FR 80055); CCDF 3 years from submission of the financial reports (45 CFR 98.90(e)). The longest applicable floor governs a multi-program deployment. State series, one per program (Georgia Archives, checked 2026-09-18): DHS retention schedule (agency 144) — https://www.georgiaarchives.org/records/agencyprint/144 — series 1976-0110 "Food Stamp Administrative Files" (3 years) for SNAP, 1973-0476 "Public Assistance Authorization Files" (3 years or until resolution of audit, whichever is longer) for TANF and 1982-0547 "Public Assistance Client Medical Eligibility Closed Case Files" (Central Medical Eligibility Office, 3 years after the client is no longer eligible for assistance) for Medicaid; DECAL retention schedule (agency 157) — https://www.georgiaarchives.org/records/agencyprint/157 — series 0469-06-003 "Childcare and Parent Services (CAPS)" (3 years after the end of the calendar year) for CCDF. Each state series matches its federal floor’s 3-year length and differs only in trigger (audit resolution, end of eligibility, calendar year-end), so the later-ending of the state and federal windows governs each envelope. Rows are not deleted in production; archive moves are operator-driven, never migration-driven (ADR-016).

Indexes

  • idx_eligibility_requests_application — request lookup by application

  • idx_eligibility_requests_household — request lookup by household

  • idx_eligibility_requests_status — status filter on the orchestration queue

  • idx_unique_pending_request (unique, partial, WHERE status IN ('pending','in_progress'), migration 20260402000000) — prevents duplicate concurrent runs for the same (application_id, household_id)

  • idx_program_determinations_request — per-run determination fan-in

  • idx_program_determinations_program — program filter across determinations

  • idx_program_determinations_application — determination lookup by application

  • idx_program_determinations_household_determined_at (migration 20260804000000) — newest-first case-status lookup per household (#1196; the history is append-only and unbounded, so this read must stay index-scan class)

  • idx_program_determinations_household_program_determined_at (migration 20260804000000) — the #694 program-scoped case-status variant; also the leading-column match for the #2178 newest-per-program read (LATEST_DETERMINATIONS_BY_HOUSEHOLD_SQL, whose id DESC tiebreak the index does not carry — its EXPLAIN pin in determination_index_scan_test.rs allows the resulting sort)

  • idx_program_determinations_alert_status_v2 (partial, (determined_at DESC, id DESC) WHERE status IN ('denied', 'sanctioned'), rebuilt by migration 20270111000000 without the old AND signature_verified term and the four pruned tokens) — cross-program alerts panel feed; superseded the status-only idx_program_determinations_alert_status (20260804000000, dropped by 20260819000000); the predicate must stay in lockstep with list_recent_alert_determinations or the planner stops substituting it (pinned by the EXPLAIN regression test in determination_index_scan_test.rs)

  • idx_program_determinations_alert_household (partial, (household_id, determined_at DESC, id DESC) with the same alert predicate, rebuilt by 20270111000000) — the household-scoped alerts variant

  • idx_quarantined_determinations_received (received_at, id) — the open-worklist keyset; idx_quarantined_determinations_household (household_id) — the supersession probe (#2061)

  • quarantine_resolutions_one_per_revision (UNIQUE (quarantined_id, revision)); quarantine_resolutions_one_dismiss (UNIQUE partial, (quarantined_id) WHERE action = 'dismiss') — at most one dismiss per envelope; quarantine_resolutions_one_promotion (UNIQUE partial, (quarantined_id) WHERE action = 'reverify' AND determination_id IS NOT NULL) — at most one promotion per envelope (#2061)

  • held_determination_resolutions_determination_id_key (UNIQUE (determination_id)) — one resolution per determination (#3065)

  • idx_combined_results_request — combined result by run

  • idx_combined_results_application — combined result by application

  • idx_combined_results_household — combined result by household

  • idx_eligibility_requests_bulk_case (partial, WHERE bulk_case_id IS NOT NULL) and idx_unique_pending_bulk_case (UNIQUE partial, (bulk_case_id) WHERE status IN ('pending','in_progress')) — the #1213 bulk pair: one live request per cohort case

  • idx_eligibility_requests_origin (partial, (origin_source, origin_ref) WHERE origin_ref IS NOT NULL) — the #1504 order-to-request correlation

  • program_determinations_request_program_subject_uniq (UNIQUE NULLS NOT DISTINCT (eligibility_request_id, program, person_id), migration 20260616120000) — one determination row per subject per (request, program) (ADR-035 Decision 6)

  • program_determinations_operation_subject_uq (UNIQUE partial, (operation_id, person_id) NULLS NOT DISTINCT WHERE operation_id IS NOT NULL) — an operation settles into at most one row per subject (#2673; it replaced #788’s program_determinations_operation_uq on (operation_id), which would refuse the second subject of a canopy-medicaid dispatch now that every subject’s envelope signs the operation; a household program’s NULL subject keeps one row per operation)

  • cohort_runs_single_active_uq (UNIQUE partial over the constant (1), WHERE state NOT IN ('completed','completed_with_failures','canceled','failed')) — the fleet holds ONE active cohort run

  • cohort_cases_state_idx (run_id, state); cohort_cases_due_idx (partial, (run_id, next_attempt_at) WHERE state IN ('pending','failed_retryable')) — the dispatcher’s due scan; cohort_cases_dispatched_idx (partial, WHERE state = 'dispatched') — the stale-dispatch re-arm; cohort_cases_failures_idx (partial, (run_id, seq) WHERE state IN ('failed_terminal','skipped_superseded')) — the failure listing

  • cohort_case_attempts_real_uq (UNIQUE partial, (case_id, phase, dispatch_generation, attempt_no) WHERE attempt_no IS NOT NULL) — one real attempt per ordinal; cohort_case_attempts_breaker_idx (partial, (run_id, phase, finished_at DESC, id DESC) excluding yields and late-dropped settles) — the failure-rate breaker window

  • cohort_run_actions_run_idx (run_id, created_at) — the operator ledger read

  • determination_orders_due_idx (partial, (next_attempt_at) WHERE state IN ('pending','failed_retryable') AND attempt_started_at IS NULL) — the order sweep; determination_orders_claimed_idx (partial, WHERE attempt_started_at IS NOT NULL) — the stale-claim re-arm; the table also carries UNIQUE (origin_source, origin_ref) (#1504)

  • determination_operations_open_uq (UNIQUE partial, (application_id, program) WHERE settled_at IS NULL) — ONE open claim per pair (#788)

  • determination_order_operations_epoch_uq (UNIQUE, (origin_source, origin_ref, program_epoch, program)) — one operation per order epoch and program (#2652)

  • generated event_outbox_* / event_inbox_* indexes — described once in the data-models index

Migration files

The eight event_outbox / event_inbox files (20260508000000, 20260516000000, 20260518004851, 20260713000000, 20260720000000, 20260803000000, 20260815000000, 20260904000000) are generated copies of crates/canopy-mq/outbox-migrations/ (cargo xtask outbox-migrations --write, parity-gated by --check); they are described once in the data-models index. The service-owned files, in timestamp order:

  • 20260326000000_create_eligibility_tables.sql — original orchestrator schema (eligibility_requests, program_determinations, combined_results) plus base lookup indexes

  • 20260402000000_add_constraints.sql — eligibility_requests_status_check closed-set status constraint + idx_unique_pending_request partial unique index (test-coverage-audit hardening)

  • 20260616000000_add_person_id_to_program_determinations.sql — ADR-035 Slice 1 (#857): nullable program_determinations.person_id per-subject column; NULL = household-level subject (SNAP/TANF), never the head’s id

  • 20260616120000_add_program_determination_subject_unique.sql — ADR-035 Decision 6: program_determinations_request_program_subject_uniq, UNIQUE NULLS NOT DISTINCT (eligibility_request_id, program, person_id) — one determination row per subject per (request, program)

  • 20260804000000_pd_lookup_indexes.sql — the three #1196 program_determinations lookup indexes. Deliberately transactional (NOT CONCURRENTLY): sqlx serializes concurrent migrators on a per-database advisory lock, and a second booting replica blocks on it holding the very snapshot CONCURRENTLY waits out — a reproduced hard deadlock whose victim can be the build itself, stranding an INVALID index behind IF NOT EXISTS. Operators upgrading an already-huge live table pre-create the same indexes CONCURRENTLY out of band (verify pg_index.indisvalid), and the migration no-ops

  • 20260819000000_alert_indexes_scoped_and_verified.sql — #596: idx_program_determinations_alert_status_v2 (adds AND signature_verified + an id DESC tiebreak to the alert predicate) and the household-scoped idx_program_determinations_alert_household; drops the superseded v1 idx_program_determinations_alert_status. Non-CONCURRENTLY for the same advisory-lock rationale as 20260804000000

  • 20261120000000_cohort_runs.sql — #1213: the cohort-run substrate — cohort_runs, cohort_cases, cohort_case_results, cohort_case_attempts, cohort_run_actions (+ the single-active-run partial unique); eligibility_requests gains bulk_case_id / bulk_program_epoch; program_determinations gains trigger / policy_target (the five cohort rows in the Tables list)

  • 20270107000000_cohort_runs_excluded_expedited.sql — #806: cohort_runs.excluded_expedited (BIGINT NOT NULL DEFAULT 0, CHECK ≥ 0) — the universe rows excluded at admission

  • 20261125000000_determination_orders.sql — #1504: the determination_orders table + its due / stale-claim partial indexes; eligibility_requests gains the origin_source / origin_ref correlation pair (both-or-neither CHECK + partial index)

  • 20261203000000_pd_policy_target_provenance.sql — #1479: program_determinations.evaluated_as_of DATE — the #1467 attestation’s evaluation date; no backfill (NULL = no signed attestation arrived)

  • 20261204000000_uprov_b_determination_operations.sql — #788: the determination_operations claim ledger + open-claim partial unique; program_determinations gains the nullable provenance trio (effective_date_basis, benefit_effective_date, operation_id + its partial-unique); cohort_cases gains the bulk mint trio (stamped write-once at the claim; since #806 the claim mints the operation id and freeze_provenance stamps the basis + anchor after the live read)

  • 20270101000000_program_extension.sql — #1709: program_determinations.program_extension JSONB NULL — the signed envelope’s program-specific payload persisted as it arrived (medicaid assigned_coa, snap following_month), so the verified envelope stays reconstructable from the row; NULL = pre-#1709 / no-extension / bulk-adopted, never backfilled

  • 20270102000000_signed_envelope_columns.sql — #1764: the last signed inputs the row could not supply — program_determinations gains snapshot_hash TEXT NOT NULL, denial_reason_codes TEXT[] and previous_determination_id UUID. snapshot_hash lands NOT NULL because the envelope field is a required String; the cutover is the one canopy-snap’s 20260810000000_snapshot_hash_not_null.sql set in #911 — clear the cohort_case_results ledger rows that point at them (no FK exists on determination_id), then delete every program_determinations row lacking the hash, then SET NOT NULL. On any pre-#1764 database that empties both tables: no production data exists pre-1.0 and the devstack re-seeds. No FK, no CHECK, no backfill

  • 20270111000000_quarantined_determinations.sql — #2061: a delete cutover — cohort_case_results then program_determinations are emptied (no stored row carries the bytes that verified; devstacks refill through the e2e reseed); program_determinations gains signed_payload BYTEA NOT NULL and drops signature_verified; the two alert partial indexes are rebuilt on status IN ('denied', 'sanctioned'); the quarantined_determinations table with its two indexes

  • 20270111000001_determination_status_check.sql — #628: deletes any program_determinations row outside approved / denied / sanctioned (its cohort_case_results rows first) and adds program_determinations_status_verdict; clears an out-of-vocabulary cohort_cases preview (the pair, its amounts and previewed_at go NULL; the case stays) and adds the two preview CHECKs

  • 20270112000000_quarantine_resolutions.sql — #2061: the quarantine_resolutions ledger with its CHECKs, unique indexes and append-only trigger

  • 20270113000000_determination_order_operations.sql — #2652: the determination_order_operations order-ledger table (v7 operation_id PK, the per-(origin, epoch, program) unique) that pins every execution of an order epoch to one claimed operation per program

  • 20270207000000_program_determinations_operation_subject.sql — #2673: program_determinations_operation_uq on (operation_id) becomes program_determinations_operation_subject_uq on (operation_id, person_id) NULLS NOT DISTINCT, one row per operation and subject

  • 20270208000000_quarantine_dispatched_operation.sql — #2319: quarantined_determinations.dispatched_operation_id UUID (nullable, no backfill), the dispatch’s claimed operation a reverify binds

  • 20270211000000_decision_stamps_no_default.sql — drops the defaults of every decision stamp the service’s production INSERTs bind from the run’s instant: program_determinations.received_at / created_at, combined_results.assembled_at / created_at and quarantined_determinations.received_at (bound by quarantine_bytes since #3013). An insert that names no stamp now fails instead of taking the database clock, and cargo xtask migrations-lint refuses a new clock default (#3013). The file’s header lists the clock defaults that stay

  • 20270301000000_held_determination_resolutions.sql — #3065: the held_determination_resolutions ledger with its CHECKs, its unique determination_id and its append-only trigger

  • 20270302000000_determination_operations_request.sql — #3065: determination_operations.eligibility_request_id UUID (nullable, no FK, no backfill), the claiming run’s request, which a held adoption routes by

  • 20270324000000_determination_status_withheld.sql — ADR-052: replaces program_determinations_status_verdict and the two cohort_cases_preview_*_status_verdict constraints so the list also admits withheld; no row is rewritten.

  • 20270325000000_program_determination_extension.sql — ADR-052: adds program_determinations.extension (JSONB, nullable), the signed envelope's record of the extension module that took part, so the row still rebuilds to the signed bytes. NULL is an envelope no module took part in.

All migrations are forward-only per ADR-016.

Edit this page · default