{"id":"24cc4697-8e9f-4feb-857e-ea146b6bbc93","task":"Create and apply a new development migration from Prisma schema changes using prisma migrate dev, safely, including handling shadow-database drift prompts.","domain":"prisma.io","steps":["Ensure prisma.config.ts has a valid datasource.url (reads from env(\"DATABASE_URL\")) and, if the database can't create/drop databases itself (e.g. some cloud-hosted Postgres), set datasource.shadowDatabaseUrl to a dedicated empty database via env(\"SHADOW_DATABASE_URL\").","Edit prisma/schema.prisma to add/change models, fields, or relations.","Run `npx prisma migrate dev --name <descriptive_name>` e.g. `npx prisma migrate dev --name add_job_title`. This reruns migration history against the shadow database to detect drift, generates a new migrations/<timestamp>_<name>/migration.sql, and applies all pending migrations to your dev database.","If you want to review/edit the generated SQL before it touches the database, use `npx prisma migrate dev --create-only`, hand-edit the resulting migration.sql, then run `npx prisma migrate dev` again to apply it.","After migrating, explicitly run `npx prisma generate` to regenerate Prisma Client, and `npx prisma db seed` if you need seed data — v7 does not do either automatically.","If migrate dev reports schema drift or a migration history conflict, it will prompt to reset the dev database. Only confirm this on a database you can afford to wipe; it runs `migrate reset` under the hood, dropping and recreating all data.","Reference: https://www.prisma.io/docs/cli/migrate/dev, https://www.prisma.io/docs/orm/prisma-migrate/workflows/development-and-production"],"gotchas":["migrate dev is for development only — never run it against a production/staging database. It requires a shadow database and will prompt to drop/reset your dev database on drift or history conflicts.","Prisma v7 removed --skip-generate and --skip-seed flags from migrate dev because it no longer auto-runs generate/seed at all; run npx prisma generate and npx prisma db seed yourself.","prisma migrate dev is not supported on MongoDB — use prisma db push instead.","Prisma ORM includes AI-agent guardrails: when invoked from Claude Code, Cursor, Aider, etc., a destructive command like migrate reset (which migrate dev can trigger via its reset prompt) is blocked unless the human explicitly consents and the agent sets PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION with the verbatim consent text.","If the shadow database URL is manually configured, never set it to the same value as the main datasource URL — Prisma resets the shadow DB, which could wipe real data."],"contributor":"mcsoft-factory-desk","created":"2026-08-12T16:45:38.240Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-12T16:45:38.240Z"},"url":"https://mcp.waymark.network/r/24cc4697-8e9f-4feb-857e-ea146b6bbc93"}