Setting the file. One moment.
Subchapter 1.5
references/db-push.mdMarkdown3 KBView on GitHub
Pushes schema changes directly to database without creating migrations. Ideal for prototyping.
prisma db push [options]| Option | Description |
|---|---|
--force-reset | Force a reset of the database before push |
--accept-data-loss | Ignore data loss warnings |
--schema | Custom path to your Prisma schema |
--config | Custom path to your Prisma config file |
--url | Override the datasource URL from the Prisma config file |
When Prisma detects an AI agent, --force-reset and --accept-data-loss require explicit user consent. Follow agent-safety.md; never infer or fabricate the consent text.
prisma generate explicitly when you need refreshed client outputprisma db pushprisma db push --accept-data-lossRequired when changes would delete data (dropping columns, etc.)
prisma db push --force-resetCompletely resets database and applies schema.
prisma db push
prisma generatemigrate deploy| Feature | db push | migrate dev |
|---|---|---|
| Creates migration files | No | Yes |
| Tracks history | No | Yes |
| Requires shadow database | No | Yes |
| Speed | Faster | Slower |
| Rollback capability | No | Yes |
| Best for | Prototyping | Development |
MongoDB doesn’t support migrations. Use db push exclusively:
# Schema changes for MongoDB
prisma db push
prisma generate# Make schema changes
# ...
# Push to database
prisma db push
# Generate client
prisma generate
# Test your changes
# Repeat as neededprisma db push --force-reset
prisma db seedIf db push can’t apply changes safely:
Error: The following changes cannot be applied:
- Removing field `email` would cause data loss
Use --accept-data-loss to proceedDecide whether data loss is acceptable, then:
prisma db push --accept-data-lossWhen ready for production, switch to migrations:
# Create baseline migration from current schema
prisma migrate dev --name initThen use migrate dev for future changes.