- use
prisma migrate devlocally to evolve your schema - use
prisma migrate deployin staging / production env to apply those changes safely and incrementally.
How Prisma tracks migrations
When running prisma migrate deploy in production
- reads
prisma/migrationsfolders. - checks the
_prisma_migrationstable in production (or env) db. - applies any new migrations that haven’t been run yet
Manual Consolidate
Tip
- It’s only safe to run when in early development and no production db exists.
- Single developer and resetting all env together.
- Okay with resetting the database and loosing all data.
Resets database (will erase data)
npx prisma migrate resetDelete all migrations
rm prisma\migrations -rCreate fresh baseline migration
npx prisma migrate dev --name baselineWarning
Do not do this on production if other env rely on existing migration history.