feat(codes): code NOT NULL voor PBI/Story + Task.code + product_id denorm

- Pbi.code en Story.code worden NOT NULL (tot dusver optional)
- Task krijgt code String + product_id String denorm + @@unique([product_id, code])
- Product krijgt back-relation tasks Task[]
- Migratie backfillt bestaande NULL-rijen via PL/pgSQL:
  PBI-N (per product), ST-N (3-digit padded met GREATEST om
  truncatie van LPAD bij 4-digit nummers te voorkomen),
  T-N voor alle tasks
- Codes zijn stabiele identifiers (Jira-stijl flat-per-product),
  zodat re-parenting de code niet muteert

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-05-04 08:36:19 +02:00
parent 4b0ab8e4b2
commit 611b621d75
3 changed files with 84 additions and 2 deletions

1
docs/erd.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 552 KiB