Best way to manage Prisma migrations across multiple developers? #198781
Saif0933
started this conversation in
A Welcome to GitHub
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Discussion Body (Question)
Hi everyone,
I am working on a Node.js + Prisma + PostgreSQL project with multiple developers.
Sometimes one developer creates migrations and pushes them to GitHub, while another developer already has local database changes. This occasionally causes migration conflicts or drift issues.
What is the recommended workflow for managing Prisma migrations in a team environment?
Specifically:
I would appreciate hearing about real-world workflows and best practices.
Thanks!
Answer
A workflow that works well for many teams is:
Every schema change should be committed as a migration.
Example:
prisma migrate dev --name add_employee_table
Commit both:
Never commit only the schema file.
Before starting work, pull the latest changes and run:
prisma migrate dev
This keeps your local database synchronized with the migration history.
Avoid manually modifying the database outside Prisma migrations.
Direct database changes often cause migration drift.
For production environments, use:
prisma migrate deploy
instead of prisma migrate dev.
Keep one shared migration history in Git and make migration reviews part of the pull request process.
This approach helps prevent drift, keeps all environments consistent, and makes deployments more predictable.
Beta Was this translation helpful? Give feedback.
All reactions