canopy-reporting Data Model

NOTE

#1456 (ADR-004): every table and function in this schema is owned by canopy_reporting_owner (NOLOGIN); the runtime connects as the restricted canopy_reporting_app login holding only the enumerated per-object grants (migrations 20261111000000/20261111000001). The sealed extract is never UPDATEd and the six generation-scoped tables are DELETE-able only through the SECURITY DEFINER reporting_janitor_reap fn, which re-verifies superseded/abandoned-past-retention eligibility inside the definer. Cutover/rollback: security-operations.

Tables

Table Purpose

snap_monthly_reports

FNS-388 SNAP monthly state activity report header (7 CFR 272.11). One row per (generation_id, report_month) — uniqueness moved onto the output generation by the #1202 run substrate; readers resolve the month’s PUBLISHED generation and serve only its row. Carries the aggregate household / individual / benefit counts, expedited + elderly/disabled splits, initial-cert vs recert split (classified by the LEGAL receipt month — never the UTC one, #1584), the calculated average_household_benefit, and the submission_status ∈ {draft, final, submitted, accepted, rejected} plus fns_confirmation_number from FNS acceptance — the lifecycle is LIVE since #1335 (POST /v1/reporting/snap/fns-388/{month}/submission, CAS transitions on the published generation’s row; submitted/accepted arm the #1202 immutability guard). The app role’s UPDATE grant is column-scoped to the three lifecycle columns (report figures stay immutable to the service). report_data JSONB is a write-only freeform assembly-provenance blob (no reader consumes specific keys, #898; the run pipeline writes assembly_source: "report_run_pipeline" since #1202). The author is a mandatory actor pair since #1008: generated_by (TEXT, a human’s OIDC subject) and generated_by_service (TEXT, a service principal), with snap_monthly_reports_generated_by_one_actor (CHECK (num_nonnulls(generated_by, generated_by_service) = 1)). The run pipeline writes generated_by_service = 'canopy-reporting'.

snap_qc_universe

FNS-7176 Quality Control universe snapshot (7 CFR Part 275). One row per (generation_id, household, snapshot_date) — uniqueness moved onto the output generation by the #1202 run substrate; readers resolve the date’s PUBLISHED generation and filter by it. Carries the full deduction stack used in the QC review (earned-income / standard / dependent-care / medical / shelter / child-support) and the resulting net_income + benefit_amount, plus flags QC reviewers reach for first (expedited_service, abawd_household, ievs_match_completed, categorical_eligibility). abawd_household is nullable since the #1202 honesty migration: NULL = "unverified legacy" — all pre-migration values were NULLed because an outage-fabricated false is indistinguishable from a sourced false; a stored true/false is a SOURCED value from that migration onward, and the CSV renders NULL as an empty cell (#1155 precedent).

tanf_acf199_snapshots

ACF-199 monthly TANF case snapshot. One row per (generation_id, report_month, case_id) — uniqueness moved onto the output generation by the #1202 run substrate; readers resolve the month’s PUBLISHED generation (or the latest published, when no month is given) and serve only its rows. One family row per assistance unit (household) per month (#3052): case_id is the determination chosen among the household’s approved determinations in the month’s universe — the one in force on the month’s last day, else the latest-starting, a tie going to the later effective date and then the later-drained determination (worker/tanf/family_row.rs). The choice reads each universe row’s coverage window from report_run_universe.aux, and every other approved determination of the household is counted in the generation’s detail_counters as superseded_in_month, with no row. family_type CHECK ∈ {single_parent, two_parent, child_only}; case_status (the case’s TANF verdict) CHECK ∈ {approved, denied, sanctioned, withheld} (tanf_acf199_snapshots_case_status_verdict, #628). A withheld case (ADR-052) is counted as not approved in every report: no report has a category for it. family_type is typed from W, the unit’s work-eligible members (45 CFR 261.2(n)), as canopy-tanf’s family-composition:batchGet answers them for the determination and month (#2975): W empty is child_only; two members of W who are each a parent, of a kind in [tanf.wpr].two_parent_parent_kinds, of the same minor child are two_parent, unless both are minors and neither is the head of household (45 CFR 261.24(c)); anything else is single_parent. work_eligible_count is the size of W (NULL for a row extracted before 20270219000000_acf199_family_type.sql). household_size, adult_count and child_count still count the household roster. Carries average_weekly_total_hours + average_weekly_core_hours (NUMERIC(6,2), #2316): each member of W’s average weekly countable hours from canopy-tanf’s work-activity summary, summed across W and truncated to 0.01, the two-parent numerators' inputs. assisted_whole_month (#2316) marks a family whose determination’s coverage window [effective_date, expiration_date] spans the whole report month; a partial month stays in the WPR denominators and counts in no numerator (#3049). Rows extracted before 20270214000000_acf199_weekly_hours.sql hold NULL in all three, and a rerun of the month refills them. Also carries state-vs-other-state month counts (60-month federal time limit + state extensions per 45 CFR 264), sanction status, and case open/closed lifecycle. childcare_funded (#1169) marks a two-parent AU receiving federally-funded child care during the report month — sourced at extraction from the CAPS linkage (any ACTIVE authorization overlapping the month; Georgia CAPS is the state CCDF program, so no finer funding-stream discriminator exists) — and flips the WPR two-parent numerator standard from 35 to 55 combined hours per 45 CFR 261.32(e)(1). The young-child standard is a member’s, on tanf_acf199_snapshot_adults (#2975); the family-level young_child column is dropped. A member of W of a single-parent family canopy-tanf cannot classify ends the run policy_input_missing and stages no row; a determination canopy-tanf holds no unit for ends it contract_violation.

tanf_acf199_snapshot_adult_weeks

One row per member of W and full week of a partial-month ACF-199 family (#3194), keyed (snapshot_id, person_id, week_start); snapshot_id references tanf_acf199_snapshots(id) ON DELETE CASCADE. Carries the member's countable total_hours and core_hours (NUMERIC(6,2)) in the week starting week_start, as canopy-tanf's activities/full-weeks:batchGet served them (#3193). A full week is seven consecutive days wholly inside the report month and the family's assisted period, counted from its first assisted day. A member canopy-tanf refused has no rows. The snapshot's full_week_count (INTEGER, CHECK >= 0) is how many full weeks the period holds: NULL for a whole-month family, 0 for a partial month with none. The WPR numerators judge a partial-month family on these rows (#3195).

tanf_acf199_snapshot_adults

One row per member of W of an ACF-199 family (#2975), keyed (snapshot_id, person_id); snapshot_id references tanf_acf199_snapshots(id) ON DELETE CASCADE, so the janitor and the batched reap reclaim the rows with their family. Carries the member’s own average_weekly_total_hours and average_weekly_core_hours (NUMERIC(6,2), truncated to 0.01) and young_child_standard: whether canopy-tanf classifies the member of a single_parent family, from the work-standard basis in force on the report month’s last day (work-standard:batchGet), as a single custodial parent or sole caretaker relative of a child under six (#1771, #2315); false in a two_parent family. The WPR all-family numerator counts a single_parent family when one member meets their own standard: the 45 CFR 261.31 figures, or the jurisdiction’s 42 USC 607(c)(2)(B) young-child hour standards (work_requirement_single_parent_hours / young_child_core_hours) for a member held to them (maintainer ruling, 2026-10-27). A two_parent family is held in both rates to the 45 CFR 261.32 combined test on the family figures. person_id is an application-level reference into canopy-persons. canopy_reporting_app holds SELECT and INSERT alone.

tanf_acf196_reports

ACF-196 quarterly TANF financial report. Composite unique on (fiscal_year, fiscal_quarter, category). fiscal_quarter CHECK 1-4. Carries the federal/state/total expenditure split and families_served; partner-blocked on real state-accounting wiring.

tanf_wpr_calculations

Monthly Work Participation Rate calculation. One row per report_month (unique). Stores both the all-family rate (target 50%) and the two-parent rate (target 90%), each with numerator/denominator/rate/meets-target columns, plus the caseload_reduction_credit. Each numerator compares the snapshot’s average weekly hours with the weekly standards and counts only assisted_whole_month families; a two-parent family also meets the 45 CFR 261.32(a)(2) / (e)(2) core floor, [tanf.wpr].two_parent_core_hours or two_parent_childcare_core_hours with federally funded child care (#2316). Each denominator counts the generation’s families of its type (child-only families are outside both). A family whose snapshot sanction_status is exempt stays in every denominator its family type belongs to (#2246). The jurisdiction’s work-requirements ruleset evaluates which families leave a denominator, and no snapshot column carries that yet (#2974).

medicaid_tmsis_eligibility_extracts

T-MSIS eligibility file rows (42 CFR 431 / 42 CFR 433). One row per (generation_id, report_month, enrollment_id) — uniqueness moved onto the output generation by the #1202 run substrate; readers resolve the month’s PUBLISHED generation (or latest) and serve only its rows. Encrypted at rest (#1256, ADR-004 Amendment 3): only the engine-evaluated keys are plaintext columns — person_id, enrollment_id, report_month, generation_id, chip_indicator, coverage_group (the 38-COA-mapped group, kept plaintext for the CMS-64 GROUP BY); the remaining attributes (eligibility_status, eligibility start/end dates, income-as-percent-of-FPL, citizenship, disability_indicator, dual_eligible_indicator + dual_eligible_category, managed-care fields, restricted_benefits_indicator) are sealed together in one restricted_payload JSONB (ADR-036 context-bound SealedValue) under a per-generation DEK, decrypted in-service on read/export. The 38-COA mapping is sourced from canopy-medicaid determinations (cross-service application FK).

redaction_keys

The ADR-036 crypto-shred key store (#1256): KEK-wrapped per-subject DEKs. subject_kind = 'report_generation' — one live DEK per report generation, sealing that generation’s T-MSIS restricted_payload rows. One-way tombstone trigger (INSERT, the live→shredded UPDATE, and since 20261224000000 the KEK rewrap — wrapped_dek replaced + kek_version strictly increased on a live row, #2113) + a partial unique index on the live subject (the atomic get-or-create’s conflict target). created_at is bound by the get-or-create from its caller (the worker’s wall-clock instant at mint); the column has no default since #2582. Identical DDL to the per-service stores shipped for canopy-persons / the program services.

medicaid_cms64_reports

CMS-64 quarterly expenditure report. Composite unique on (fiscal_year, fiscal_quarter, expenditure_category, population_group). Carries enrolled_count, member_months, and federal/state/total expenditure split. Member-months computed from T-MSIS extracts; federal share split is partner-blocked on MMIS.

medicaid_cms416_reports

CMS-416 annual EPSDT report. Composite unique on (generation_id, report_year, age_group) — uniqueness moved onto the output generation by the #1202 run substrate; readers resolve the year’s PUBLISHED generation (or latest) and serve only its rows. The producing run’s inputs are PINNED published T-MSIS generation ids (report_generations.input_generation_ids). Carries total_enrolled_children, total_member_months, eligible_for_screening, the received_initial_screening / received_periodic_screening counts, and the calculated screening_ratio. Real screening counts partner-blocked on clinical systems.

report_generations (#1202)

Permanent generation-provenance rows of the durable report-run substrate (the archived report-run-generations plan) with atomic staged→published promotion; report_generations_published_uq holds one PUBLISHED generation per (report_kind, period_date). Lifecycle: staged → published on a successful run, published → superseded when a newer run publishes, and (#1462) staged → abandoned when its run terminalizes to error (via either report_run_finalize or report_run_claim's attempts-cap path) — so the janitor, which reaps only superseded / abandoned generations' output, universe and sealed-extract rows, reclaims a failed run instead of leaking it. Model, lifecycle and operations: the report-runs runbook.

report_runs (#1202/#1203)

The guarded, token-fenced job table — generation_id FKs to report_generations (the output generation is created with the run), report_runs_active_target_uq holds ONE queued / running run per (report_kind, period_date), and the report_run_enqueue / _claim / _checkpoint / _heartbeat / _abandon / _finalize / _reap functions of 20261101000001 are its only writers (enqueue re-created by 20261207000000 so the CMS-416 input pins land in the same statement set; finalize re-created by 20270214000001 to take the refusal). error_code policy_input_missing (#2315) is a run refused because a policy input is not recorded; error_reason (work_standard_unrecorded or work_standard_child_unknown, from canopy-tanf’s work-standard classification or, since #3050, its work-activity summary) and error_person_id name the refusal and the person, and report_runs_policy_refusal_named (CHECK) holds error_code = 'policy_input_missing' exactly when both are set. Operations: the runbook.

report_run_universe (#1202)

The materialized per-run universe (generation_id FKs to report_generations); reaped with its generation through reporting_janitor_reap.

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-reporting publishes (the #1404 reporting-access audit stream; 20261129000000 grants the app role INSERT on event_outbox) but runs no Subscriber (no .subscribe( call in services/canopy-reporting/src), so event_inbox exists here unused.

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; the 20261111000000 grant matrix names it.

Relationships

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

Diagram

tanf_acf196_reports, tanf_wpr_calculations and medicaid_cms64_reports carry no generation_id and no FK (their natural keys are the fiscal quarter / report month); redaction_keys.subject_id names a report generation as an application-level pointer (subject_kind = 'report_generation').

Cross-service FKs (ADR-001 boundary)

canopy-reporting is a downstream aggregator and holds no Postgres-level FKs to other services. Every UUID that points outside canopy_reporting is an application-level reference: snap_qc_universe.household_id / certification_id (canopy-persons, canopy-snap), tanf_acf199_snapshots.case_id (canopy-tanf), medicaid_tmsis_eligibility_extracts.person_id / enrollment_id (canopy-persons, canopy-enrollment). (snap_monthly_reports.generated_by is not a UUID since #1008: it holds an opaque OIDC subject, never a reference into another service’s rows.) The aggregator pulls data via the program services' HTTP APIs (no cross-database joins) per ADR-001.

Retention

Retention floors (eCFR, checked 2026-09-16): federal-submission records are retained per federal partner. SNAP (FNS-388 / FNS-7176): no less than 3 years from the month of origin of each record (7 CFR 272.1(f)). TANF (ACF-199 / ACF-196 / WPR): no program-specific retention section exists — the HHS award-record floor is 3 years from submission of 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, and the older 45 CFR 92.42 no longer exists). Medicaid (T-MSIS / CMS-64 / CMS-416): 3 years from submission of the final expenditure report, and beyond that while audit findings are unresolved (42 CFR 433.32(b)–(c)). State series: Georgia Archives, DHS retention schedule (agency 144), series 1976-0110 "Food Stamp Administrative Files", 3 years, for the SNAP submissions, and series 1975-0080 "Medicaid Eligibility Report Files" (monthly reports: retain until verification of the following month’s report; annual report: 5 years or after audit questions resolved, whichever is longer) for the Medicaid eligibility reports — https://www.georgiaarchives.org/records/agencyprint/144 (checked 2026-09-18). The SNAP series does not exceed the federal floor, so 7 CFR 272.1(f) governs; the Medicaid monthly term is shorter than the 3-year 42 CFR 433.32(b) floor, which therefore governs the monthly submissions, while the 5-year annual term exceeds it, so the state series governs an annual one. In practice rows are retained indefinitely in production; the only DELETE path is reporting_janitor_reap over superseded / abandoned generations, and archive moves are operator-driven, never migration-driven (ADR-016).

Indexes

  • snap_monthly_reports_generation_month_uq (unique) — one row per (generation, report_month); replaced idx_snap_monthly_reports_month when uniqueness moved onto the output generation (#1202 backfill migration)

  • idx_snap_qc_universe_snapshot — per-snapshot listing

  • idx_snap_qc_universe_household — per-household lookup

  • snap_qc_universe_generation_household_snapshot_uq (unique) — one row per (generation, household, snapshot); replaced idx_snap_qc_universe_household_snapshot when uniqueness moved onto the output generation (#1202 backfill migration). Also the keyset ride for the generation-scoped paginated QC-universe reads (#1202): each page (WHERE generation_id = $1 [AND household_id > $3] ORDER BY household_id LIMIT $2) is a contiguous index range — seek, read one page, stop

  • idx_snap_qc_universe_snapshot_household — the #1221 (snapshot_date, household_id) keyset composite the pre-generation reads rode; retained for snapshot-scoped scans

  • tanf_acf199_generation_month_case_uq (unique) — one case-snapshot per (generation, month, case); replaced tanf_acf199_month_case when uniqueness moved onto the output generation (#1202 backfill migration)

  • tanf_acf199_month — per-month listing

  • tanf_acf196_fy_quarter_cat (unique) — composite uniqueness on quarterly financial report key

  • tanf_wpr_month (unique) — single WPR row per report_month

  • medicaid_tmsis_generation_month_enrollment_uq (unique) — one extract row per (generation, month, enrollment); replaced medicaid_tmsis_month_enrollment when uniqueness moved onto the output generation (#1202 backfill migration)

  • medicaid_tmsis_cms416_universe_idx — the (report_month, chip_indicator, person_id) composite the CMS-416 local-universe drain rides (half-open report-year range + chip_indicator = false + person_id keyset order, EXPLAIN-pinned; #1202); replaced the prefix-redundant single-column medicaid_tmsis_month (dropped in 20261101000004)

  • medicaid_tmsis_person — per-person lookup

  • medicaid_cms64_fy_quarter_cat_pop (unique) — composite uniqueness on CMS-64 row key

  • medicaid_cms416_generation_year_age_uq (unique) — one row per (generation, report_year, age_group); replaced medicaid_cms416_year_age when uniqueness moved onto the output generation (#1202 backfill migration)

  • report_generations_published_uq (UNIQUE partial, (report_kind, period_date) WHERE state = 'published') — one published generation per kind and period (#1202)

  • report_runs_active_target_uq (UNIQUE partial, (report_kind, period_date) WHERE state IN ('queued','running')) — ONE active run per target; report_runs_queued_idx (partial, (requested_at) WHERE state = 'queued') — the claim scan; report_runs_reclaim_idx (partial, (claim_expires_at) WHERE state = 'running') — the stale-claim reclaim; report_runs_reap_idx (partial, (finished_at) WHERE state IN ('done','error')) — report_run_reap

  • idx_redaction_keys_subject — (subject_kind, subject_id) DEK lookup; uq_redaction_keys_live_subject (UNIQUE partial, WHERE shredded_at IS NULL) — one live DEK per generation, the atomic get-or-create’s conflict target (#1256)

  • 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:

  • 20260401000000_create_reporting_tables.sql — SNAP FNS-388 monthly reports + FNS-7176 QC universe snapshot

  • 20260409000000_tanf_medicaid_reporting_tables.sql — TANF ACF-199 monthly snapshots, ACF-196 quarterly financial, WPR calculations; Medicaid T-MSIS eligibility extracts, CMS-64 quarterly expenditures, CMS-416 annual EPSDT

  • 20260723120000_qc_stub_fields_nullable.sql — #1155: the QC stub fields (expedited_service, work_registration_exempt_count, ievs_match_completed) nullable + historical values NULLed (unknown is NULL, never a fabricated false/0)

  • 20260805000000_v7_pk_defaults.sql — #1173: drops the gen_random_uuid() (UUID v4) id DEFAULT on the six TANF / Medicaid output tables; the application binds a v7 id at every INSERT

  • 20260813000000_acf199_childcare_funded.sql — #1169: tanf_acf199_snapshots.childcare_funded (BOOLEAN NOT NULL DEFAULT false) — the two-parent 55-hour WPR standard input

  • 20260820000000_qc_universe_keyset_index.sql — the (snapshot_date, household_id) keyset composite for the paginated QC-universe reads (#1221; transactional NOT CONCURRENTLY per the #1196 rationale)

  • 20261101000000_report_generations.sql + 20261101000001_report_runs.sql + 20261101000002_report_run_universe_and_legacy_backfill.sql — the #1202/#1203 durable report-run substrate (plan report-run-generations): the report_generations publication model, the guarded report_runs job table, the materialized report_run_universe, generation_id on all five output tables with uniqueness moved to (generation_id, natural key), and the legacy published-generation backfill. Backfilled legacy generations are pure DATA — run_id NULL (surfaced as provenance.run_id = null), build_version/params_hash 'legacy'; the legacy_generation_id write-path helper that stamped the synchronous extracts' rows was deleted in #1202/#1203 with its last consumers (every kind now writes through the run pipeline’s staged generations)

  • 20261101000003_abawd_household_unverified_legacy_null.sql — #1202: snap_qc_universe.abawd_household nullable + DEFAULT dropped + ALL historical values NULLed — outage-fabricated false is indistinguishable from sourced false; NULL = "unverified legacy"

  • 20261101000004_cms416_universe_index.sql — #1202/#1203: adds medicaid_tmsis_cms416_universe_idx (report_month, chip_indicator, person_id) for the CMS-416 local-universe drain and DROPS the prefix-redundant medicaid_tmsis_month

  • 20261110000000_reporting_redaction_keys.sql — the ADR-036 redaction_keys store (#1256): per-generation DEKs + one-way tombstone + live-subject unique index

  • 20261110000001_seal_restricted_reporting_stores.sql — #1256: adds error_code values admin_reset/crypto_failure; the quiesced fresh-start reset (terminalize in-flight tmsis/cms_416 runs, supersede tmsis generations, clear their universe rows + derived CMS-64/416 rows); reshapes medicaid_tmsis_eligibility_extracts (drop the 11 plaintext attribute columns, add restricted_payload)

  • 20261110000002_abandon_failed_run_generations.sql — #1462: re-creates report_run_finalize and report_run_claim so a run that terminalizes to error marks its generation abandoned, letting the janitor reap its output, universe and sealed-extract rows

  • 20261111000000_least_privilege_roles.sql — #1456 (ADR-004): creates canopy_reporting_owner (NOLOGIN) and canopy_reporting_app, moves every table and function to the owner, revokes PUBLIC, and grants the app role only the enumerated verbs (SELECT / INSERT on the output tables, UPDATE also on tanf_wpr_calculations and report_generations, full DML on report_runs and idempotency_keys, SELECT / UPDATE / DELETE on event_outbox)

  • 20261111000001_janitor_security_definer.sql — #1456: reporting_janitor_reap(uuid, int) as SECURITY DEFINER owned by canopy_reporting_owner — the only DELETE path over the generation-scoped tables; it re-verifies superseded / abandoned-past-retention eligibility inside the definer

  • 20261129000000_grant_outbox_insert_to_app.sql — #1404 (Pub 1075 §9): grants INSERT on event_outbox to canopy_reporting_app — the reporting-access audit stream makes canopy-reporting a publisher

  • 20261204000000_snap_submission_update_grant.sql — #1335: column-scoped UPDATE (submission_status, submitted_at, fns_confirmation_number) on snap_monthly_reports for the app role — the FNS-388 submission lifecycle; report figures stay immutable to the service

  • 20261205000000_honest_federal_field_dispositions.sql — medicaid_cms416_reports.total_member_months and tanf_acf199_snapshots.months_other_states drop NOT NULL + DEFAULT: an unsourced figure is NULL, never a fabricated 0 (the #1155 precedent)

  • 20261207000000_enqueue_pins_atomic.sql — #1343: drops the seven-argument report_run_enqueue and re-creates it taking the CMS-416 input-generation pins as a jsonb array, written in the same statement set that creates the generation + run (no pin-less window for a claiming worker)

  • 20261208000000_acf199_young_child.sql — #1771: tanf_acf199_snapshots.young_child (BOOLEAN NOT NULL DEFAULT false) — the single-parent young-child WPR standard input

  • 20261224000000_redaction_keys_rewrap_guard.sql — #2113: canopy_redaction_keys_one_way_guard() admits the KEK rewrap (wrapped_dek replaced + kek_version strictly increased on a live row) beside the shred

  • 20270111000001_determination_status_check.sql — #628: deletes any tanf_acf199_snapshots row whose case_status is outside approved / denied / sanctioned, then adds tanf_acf199_snapshots_case_status_verdict

  • 20270113000000_actor_subjects.sql — #1008: snap_monthly_reports.generated_by retypes UUID → TEXT (USING …::text) and gains generated_by_service TEXT; a guard raises, naming cargo xtask dev restart, on a row whose generated_by is NULL (a pipeline write that named no service) or the nil UUID — no author is invented; then snap_monthly_reports_generated_by_one_actor, VALID. The table-level SELECT, INSERT grant covers the new column; the column-scoped UPDATE grant is untouched

  • 20270117000000_redaction_keys_created_at_no_default.sql — #2582: drops the redaction_keys.created_at default; the restricted store’s get-or-create binds created_at from its caller, so an insert that names no created_at now fails instead of taking the database clock

  • 20270118000000_app_no_temporary.sql — #2573 (ADR-004): revokes TEMPORARY on the database from PUBLIC, and TEMPORARY and CREATE on it from canopy_reporting_app, so the runtime login can create no temporary table and no schema of its own name to shadow a table it reads by unqualified name; a closing audit refuses either privilege by any path

  • 20270119000000_batched_reaps.sql — #2963: replaces report_run_reap(int) and reporting_janitor_reap(uuid, int) with batch functions the worker calls in a loop, each call committing on its own. report_run_reap(older_than_days, after, batch) deletes up to batch terminal runs past the 7-day floor and returns (removed, last_id). reporting_janitor_reap(generation, retention_days, batch) deletes up to batch of the generation’s output and universe rows, re-verifying its eligibility on every call, and returns (output_rows, universe_rows). The batch is 1 to 10 000; ownership and grants are unchanged

  • 20270214000000_acf199_weekly_hours.sql — #2316: tanf_acf199_snapshots drops total_work_hours and core_activity_hours (monthly totals the WPR compared with weekly standards) and adds average_weekly_total_hours and average_weekly_core_hours (NUMERIC(6,2)) and assisted_whole_month (BOOLEAN), each commented with its 45 CFR 261.31 / 261.32 / 261.22(d) / 261.24(d) role. Earlier rows hold NULL in all three; the table-level grants cover the new columns

  • 20270214000001_acf199_work_standard_refusal.sql — #2315: report_runs.error_code admits policy_input_missing; report_runs gains error_reason (TEXT) and error_person_id (UUID) under report_runs_policy_refusal_named; report_run_finalize is dropped and re-created with p_error_reason and p_error_person_id (owner canopy_reporting_owner, EXECUTE to canopy_reporting_app alone); tanf_acf199_snapshots.young_child is re-commented to the recorded basis (42 USC 607(c)(2)(B))

  • 20270311000000_acf199_adult_full_weeks.sql — #3194: tanf_acf199_snapshots gains full_week_count (INTEGER, CHECK >= 0, NULL for a whole-month family); creates tanf_acf199_snapshot_adult_weeks (owner canopy_reporting_owner; SELECT and INSERT to canopy_reporting_app; no clock default).

  • 20270219000000_acf199_family_type.sql — #2975: tanf_acf199_snapshots drops young_child and gains work_eligible_count (INTEGER, CHECK >= 0; NULL on earlier rows); creates tanf_acf199_snapshot_adults (owner canopy_reporting_owner; SELECT and INSERT to canopy_reporting_app; no clock default). A single_parent row extracted earlier has no member rows and counts in no WPR numerator until its month is rerun

  • 20270324000000_determination_status_withheld.sql — ADR-052: replaces tanf_acf199_snapshots_case_status_verdict so the list also admits withheld; no row is rewritten.

All migrations are forward-only per ADR-016.

Edit this page · default