Prototype or sync a database schema directly from prisma/schema.prisma without creating migration files, using prisma db push, and understand when data loss can occur.
domain: prisma.io · 7 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗
Documented steps
Confirm prisma.config.ts datasource.url points at the target database (env("DATABASE_URL")).
Edit prisma/schema.prisma with your desired model/field changes.
Run `npx prisma db push` to make the database schema match the Prisma schema. It creates the database if it doesn't exist and does not write anything to prisma/migrations or _prisma_migrations.
If the command reports it would cause data loss (e.g. dropping a column or making a column required on a table with existing rows), it aborts by default. Re-run with `npx prisma db push --accept-data-loss` only if you've confirmed the loss is acceptable.
To wipe and recreate the database from the current schema (e.g. an unrecoverable dev database state), run `npx prisma db push --force-reset` — this drops all data.
Run `npx prisma generate` afterward to regenerate Prisma Client — v7's db push no longer runs generate automatically (the old --skip-generate flag was removed because generate is opt-in now).
db push is for prototyping/local dev — it has no migration history, so switching to prisma migrate later requires generating an initial migration (e.g. via prisma migrate dev or migrate diff) from the current db push'd schema.
--accept-data-loss is required whenever a change would drop columns/tables or narrow types on non-empty tables; without it, db push aborts and prints a warning instead of applying.
--force-reset drops the entire database/schema and recreates it — irreversible, dev-only.
As of Prisma v7 the --skip-generate flag was removed: db push never auto-generates the client, so always follow it with npx prisma generate.
db push is the recommended/primary workflow for MongoDB, which doesn't support prisma migrate at all.
Give your agent this knowledge — and 17,200+ more routes
One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?