Author, validate, and document Postgres schema migrations in this monorepo. Use when asked to add tables/columns/indexes, modify schema, or prepare rollback-safe DB changes.
Use this skill for all schema changes in db/migrations.
This repo uses a shared Postgres schema used by both APIs.
Create paired files in db/migrations:
NNNNNN_description.up.sqlNNNNNN_description.down.sqlRules:
Reference: docs/db-migrations.md
down migration reverses dependency order (children before parents) when feasible.If schema changes affect API payloads or behavior:
docs/openapi/api-java.yaml or docs/openapi/api-go.yaml)Run migration and seed flow from repo root:
npm run db:migratenpm run db:seedThen run relevant tests:
npm run test:e2e:backend for cross-service confidencedb/seeds/demo.sql (or other seed files), not migration files.