v0 database

Prisma Migration Conflict After Schema Changes

After modifying your Prisma schema, migrations fail with 'Migration conflict' or 'Schema divergence detected' errors. Your database schema doesn't match the generated migrations.

This typically occurs when multiple developers create conflicting migrations or the local migration history doesn't match the database state.

Error Messages You Might See

[migrate] Conflict detected [migrate] Schema divergence detected The migration `xxxxxxxx_migration_name` already exists Database schema doesn't match your Prisma schema
[migrate] Conflict detected[migrate] Schema divergence detectedThe migration `xxxxxxxx_migration_name` already existsDatabase schema doesn't match your Prisma schema

Common Causes

  1. Two developers created different migrations with the same timestamp or conflicting changes
  2. Local migration files were deleted but database state remains
  3. Database already has the schema changes but Prisma migrations don't reflect this
  4. Merging branches with different migration histories
  5. Manual database changes made outside of Prisma migrations

How to Fix It

Resolve merge conflicts: If merging branches, check git history of migrations/ folder for conflicts. Resolve manually and recreate new migration.

Reset in development: For dev only: npx prisma migrate reset clears database and replays migrations from scratch.

Recovery in production: Use npx prisma migrate resolve --rolled-back migration_name to mark failed migration as rolled back, then create a new one.

Prevent conflicts: Use npx prisma migrate dev --name descriptive_name to create new migrations, commit them before pushing.

Real developers can help you.

Daniel Vázquez Daniel Vázquez Software Engineer with over 10 years of experience on Startups, Government, big tech industry & consulting. Stanislav Prigodich Stanislav Prigodich 15+ years building iOS and web apps at startups and enterprise companies. I want to use that experience to help builders ship real products - when something breaks, I'm here to fix it. Tejas Chokhawala Tejas Chokhawala Full-stack engineer with 5 years experience building production web apps using React, Next.js and TypeScript. Focused on performance, clean architecture and shipping fast. Experienced with Supabase/Postgres backends, Stripe billing, and building AI-assisted developer tools. Meïr Ankri Meïr Ankri Full-stack developer specializing in React / Next.js / Node.js with 6+ years of experience. I've worked across various sectors including automotive (Reezocar/Société Générale), healthcare (Medical Link SaaS), and e-commerce (Glasman). I build web apps end-to-end, from architecture to production, with a focus on scalability, performance, and code quality. I also mentor junior developers and contribute to technical decisions and code reviews. David Olverson David Olverson Solo dev shipping production apps with AI-assisted development. I specialize in rescuing broken Lovable/Bolt/Cursor builds and taking them to production. 10+ apps shipped including SaaS CRMs, gaming platforms, real estate tools, and Discord bots. Stack: Next.js 16, TypeScript, Tailwind CSS, FastAPI, PostgreSQL, Prisma. I use Claude Code with 50+ custom skills for rapid delivery. Average turnaround: 2-4 weeks from broken prototype to production. legrab legrab I'll fill this later Omar Faruk Omar Faruk As a Product Engineer at Klasio, I contributed to end-to-end product development, focusing on scalability, performance, and user experience. My work spanned building and refining core features, developing dynamic website templates, integrating secure and reliable payment gateways, and optimizing the overall system architecture. I played a key role in creating a scalable and maintainable platform to support educators and learners globally. I'm enthusiastic about embracing new challenges and making meaningful contributions. MFox MFox Full-stack professional senior engineer (15+years). Extensive experience in software development, qa, and IP networking. Pratik Pratik SWE with 15+ years of experience building and maintaining web apps and extensive BE infrastructure Kingsley Omage Kingsley Omage Fullstack software engineer passionate about AI Agents, blockchain, LLMs.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

Can I delete migration files if I haven't deployed?

Only if your local database matches your schema. Reset with 'prisma migrate reset' first, then delete conflicts.

How do I handle migration conflicts in team development?

Establish a process: create descriptive migration names, merge feature branches before creating new migrations.

What's the difference between migrate dev and migrate deploy?

'migrate dev' is interactive, creates new migrations. 'migrate deploy' applies existing migrations to prod without prompts.

Related v0 Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help