Database Development
Use Drizzle to generate migration metadata; do not hand-edit journals or
snapshots. Numbered external-data migration scripts are permanent historical
records, even after their referenced schema is retired. Keep them self-contained
and dry-run by default.
TypeScript generics do not decode PostgreSQL results. Use the first applicable
schema column, installed Drizzle helper, or reviewed runtime decoder; preserve
nullability, precision, and provenance. Query rewrites must preserve the whole
SQL contract, including bindings, transactions, locks, and material plan costs.
The query reference contains the complete decision order and examples.