Apply schema changes from repo SSOT (prisma/schema.prisma) to a target DB via Prisma migrations, with diff preview + approval gate; then refresh LLM context (docs/context/db/schema.json).
Treat prisma/schema.prisma as the schema Single Source of Truth (SSOT) and safely apply schema changes to a target database with:
docs/context/db/schema.jsonThis skill is intentionally written for a development workflow (developers manage DB changes via Prisma), not a DBA-centric workflow.
This skill MUST be used only when the project DB SSOT is repo-prisma:
prisma/schema.prismaIf the project uses database-as-SSOT, use sync-code-schema-from-db instead.
To check the mode, read:
docs/project/db-ssot.jsonUse when the user asks to:
schema.prisma and the actual DBAvoid when:
prisma db pull) (use sync-code-schema-from-db)prisma/schema.prisma.docs/context/db/schema.json (generated; do not hand-edit).See ./reference/prisma-ssot-mechanism.md for the end-to-end pattern (domain vs persistence vs DTO).
dev / staging / prod (must be explicit)DATABASE_URL via environment; never paste secrets into chat)prisma migrate)prisma db push only if explicitly chosen (and justified)Choose one evidence location (no secrets):
dev-docs/AGENTS.md Decision Gate (recommended for staging/prod):
dev-docs/active/<task-slug>/artifacts/db/.ai/.tmp/db-sync/<run-id>/Evidence files:
00-connection-check.md01-schema-diff-preview.md02-migration-plan.md03-execution-log.md04-post-verify.mdrepo-prisma (docs/project/db-ssot.json).
sync-code-schema-from-db.Apply the schema change in prisma/schema.prisma (SSOT).
Run local validation (read-only against schema):
npx prisma formatnpx prisma validateProduce a diff preview (no DB writes):
npx prisma migrate dev --create-only --name <slug> (dev)prisma/migrations/*/migration.sql.Write 01-schema-diff-preview.md and 02-migration-plan.md:
03-execution-log.md:npx prisma migrate deploynpx prisma migrate devnpx prisma db pushnpx prisma migrate statusRecord evidence in 04-post-verify.md.
node .ai/scripts/ctl-db-ssot.mjs sync-to-context(If context-awareness is enabled, the command also runs ctl-context touch best-effort.)
repo-prismadocs/context/db/schema.json refreshed via ctl-db-ssotnode .ai/tests/run.mjs --suite databaseprisma migrate)