Story: SQL codegen drift remediation
Table of Contents
This page documents a story in Sprint 17. It captures the goal, current status, acceptance criteria, and the tasks that compose it.
Goal
Eliminate all hand-crafted SQL files that have live codegen models: fix Categories A and B (template and profile issues), replace report_definitions and three other SQL files, fix entity model profile dispatch and composite natural-key indexes, and add cross-platform null device support for psql output redirection.
Status
| Field | Value |
|---|---|
| State | DONE |
| Parent sprint | Sprint 17 |
| Now | Completed 2026-05-17. |
| Waiting on | None. |
| Next | None. |
| Last touched | 2026-05-17 |
Acceptance
- All tasks complete; PR-by-PR breakdown in
git log.
Tasks
| Task | State | Start | End | Description |
|---|---|---|---|---|
| Task: Add cross-platform null device support for psql output redirection | DONE | 2026-05-22 | 2026-05-22 | Add platform-agnostic null device detection to support database setup on both Unix-like systems and Windows/MINGW enviro |
| Task: [sql] Codegen drift remediation: Categories A and B | DONE | 2026-05-22 | 2026-05-22 | - Category B (naming/missing): Fixed index naming inconsistencies and added missing `lifecycle_events` SQL that codegen |
| Task: [sql] Codegen drift remediation: template fixes + report_definitions | DONE | 2026-05-22 | 2026-05-22 | Continues codegen drift remediation from PR #747, addressing three categories of work: |
| Task: [sql] Replace 4 remaining hand-crafted SQL files with codegen | DONE | 2026-05-22 | 2026-05-22 | - Extends `sql_schema_domain_entity_create.mustache` and `generator.py` with |
| Task: [codegen] Fix entity model profile dispatch and composite natural-key indexes | DONE | 2026-05-22 | 2026-05-22 | - Add `schema` model type to the `sql` profile in `profiles.json` so plain entity models (`*_entity.json`) are dispatche |
Decisions
- Zero tolerance
- every SQL file with an existing codegen model must be generated; hand-crafted files are a maintenance liability and a source of schema drift.
Out of scope
- New SQL entities without codegen models (deferred to when models are added).