signatureFields nullable JSONB: template starts empty; Phase 19 fills it via PATCH
formTemplateId FK has no onDelete cascade: archived templates remain even if form is removed
archivedAt nullable timestamp: NULL = active; soft-delete only (no hard deletes)
updatedAt set explicitly in UPDATE queries, not via DB trigger (existing pattern)
duration
completed_date
tasks_completed
files_changed
4 min
2026-04-06
2
2
Phase 18 Plan 01: Template Schema and Migration Summary
One-liner: Drizzle document_templates table with 7 columns, nullable JSONB fields, soft-delete via archivedAt, FK to form_templates with no cascade, and auto-generated SQL migration 0012.
Also added documentTemplatesRelations joining to formTemplates via formTemplateId.
Generated migration 0012_ancient_blue_shield.sql via drizzle-kit generate. The migration contains only a CREATE TABLE statement and an ALTER TABLE ... ADD CONSTRAINT for the FK — no alterations to existing tables.
Verification
npx tsc --noEmit — zero errors
ls drizzle/0012_*.sql — exactly one migration file (0012_ancient_blue_shield.sql)