1.7 KiB
1.7 KiB
prisma migrate reset
Resets your database and re-applies all migrations.
Command
prisma migrate reset [options]
What It Does
- Drops the database (if possible) or deletes all data/tables
- Re-creates the database
- Applies all migrations from
prisma/migrations/ - Stops there - run seed and generate explicitly if needed
Warning: All data will be lost.
When Prisma detects an AI agent, this command is blocked until the user gives explicit consent. Follow agent-safety.md; --force skips the ordinary prompt but does not constitute user consent for an agent.
Options
| Option | Description |
|---|---|
--force / -f |
Skip confirmation prompt |
--schema |
Path to schema file |
--config |
Custom path to your Prisma config file |
Examples
Basic reset
prisma migrate reset
Prompts for confirmation in interactive terminals.
Force reset (CI/Automation)
prisma migrate reset --force
With custom schema
prisma migrate reset --schema=./custom/schema.prisma
When to Use
- Development: When you want a fresh start
- Testing: Resetting test database before suites
- Drift Recovery: When the database is out of sync and you can't migrate
Follow-up Steps
Run prisma generate and prisma db seed explicitly when you need refreshed client output or seed data after a reset.
Configuration
Configure the seed script in prisma.config.ts, then run it explicitly after reset:
export default defineConfig({
migrations: {
seed: 'tsx prisma/seed.ts',
},
})
Typical workflow:
prisma migrate reset --force
prisma generate
prisma db seed