TS-001 — Foundational Migration (Engage/CRM)
Objective: schemas core/loyalty/messaging/crm with all v1 tables, parametric seeds, designated partitions, platform tables.
Archetype: synchronous command (createInitiative patterns for services; SQL migrations custom)
Refs: DEC-B*, ADR-011/013/017/018, standards/data.md
Objective: schemas core/loyalty/messaging/crm with all v1 tables, parametric seeds, designated partitions, platform tables.
In scope: pgSchema definitions in Drizzle · parametric tables + is_system seeds + Zod union generation · money columns per standard · contacts with national_id (+types catalog, normalizers, DV validators CL/BR/AR minimum, generic format others) · partitioned DDL via SQL migrations + partition pre-creation job (cron fan-out) · audit_log, processed_jobs, dead_letters, usage_snapshots · RLS + tenant guards on every table · program default auto-creation hook on tenant provisioning.
Out: any endpoint, any worker logic beyond partition job.
Acceptance: migrations idempotent on fresh + existing dev DB · dependency-cruiser green with new schema rules · seeds generate TS unions consumed by packages/core build · DEFAULT partitions empty after synthetic month-boundary test · RLS denial tests per table.
⌘I