database

Comprehensive guidance for all database work in the Mossback platform. Covers models, schemas, tables, columns, indexes, constraints, relations, entities, data models, model definitions, model fields,

SKILL.md

GitHub

Database

Rules

  • Migrations live in db/migrations as numbered SQL files. Create one with pnpm db:new <name>.
  • Never edit a merged migration. Add a new one.
  • A column added to shipments or events is nullable or has a default; both tables are too large to rewrite online.
  • Build an index with CREATE INDEX CONCURRENTLY in its own file.
  • After a migration, run pnpm db:types and commit src/db/types.ts with it.