assessment-model/src
Khalim Conn-Kowlessar 6f38677da3 Make recommendation denormalisation backfill safe and online
The 0222-0225 batch backfilled plan_id/material_* onto recommendation
inside drizzle's single migration transaction. On the production table
(~26M rows) that held an AccessExclusiveLock for hours, blocked unrelated
migrations, exhausted EBS throughput credits, and could not report
progress or resume.

Split schema DDL from data backfill:
- 0222/0224: keep only instant metadata-only DDL (ADD COLUMN + FK
  NOT VALID); drop the inline CREATE INDEX.
- 0223/0225: backfills removed (now no-ops pointing to the script).
- New src/app/db/backfill-recommendation-denormalization.ts: idempotent,
  resumable, batched (committed per batch) backfill that then builds the
  indexes CONCURRENTLY and validates the FKs online.
- CONTEXT.md: document recommendation->plan (1:1) and recommendation->
  material (now at most 1; legacy multi-material rows reconciled).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 08:36:39 +00:00
..
app Make recommendation denormalisation backfill safe and online 2026-06-08 08:36:39 +00:00
lib removed finalise code as its needed only in the final new process 2026-05-06 16:05:24 +00:00
types next js 2025-12-08 12:20:07 +00:00
middleware.ts fixed filtering logic 2026-02-07 19:59:51 +00:00