Bolt database

Prisma Migration Failed - Schema Mismatch

Running `prisma migrate dev` fails with schema validation errors. The app can't sync with the database schema or migrations won't apply.

You see errors about 'Migration already applied', schema divergence, or the database being in a bad state preventing any migrations.

Error Messages You Might See

Error: P3005 - Database is in an inconsistent state Error: P3007 - Some of the requested changes could not be executed Migration validation error: Field constraint missing
Error: P3005 - Database is in an inconsistent stateError: P3007 - Some of the requested changes could not be executedMigration validation error: Field constraint missing

Common Causes

  1. Uncommitted changes in migration history
  2. Database schema modified outside of Prisma (manual SQL)
  3. Migration file corrupted or contains invalid SQL
  4. Trying to add non-nullable column without default value
  5. Foreign key constraints preventing schema changes

How to Fix It

Check migration status: npx prisma migrate status

Reset database in development (careful!): npx prisma migrate reset

For new non-nullable fields, add with default: @default(uuid()) or @default(now())

Review migrations folder and ensure all files are valid SQL

Real developers can help you.

Jen Jacobsen Jen Jacobsen I’m a Full-Stack Developer with over 10 years of experience building modern web and mobile applications. I enjoy working across the full product lifecycle — turning ideas into real, well-built products that are intuitive for users and scalable for businesses. I particularly enjoy building mobile apps, modern web platforms, and solving complex technical problems in a way that keeps systems clean, reliable, and easy to maintain. Bastien Labelle Bastien Labelle Full stack dev w/ 20+ years of experience Rudra Bhikadiya Rudra Bhikadiya I build and fix web apps across Next.js, Node.js, and DBs. Comfortable jumping into messy code, broken APIs, and mysterious bugs. If your project works in theory but not in reality, I help close that gap. Taufan Taufan I’m a product-focused engineer and tech leader who builds scalable systems and turns ideas into production-ready platforms. Over the past years, I’ve worked across startups and fast-moving teams, leading backend architecture, improving system reliability, and shipping products used by thousands of users. My strength is not just writing code — but connecting product vision, technical execution, and business impact. Matthew Butler Matthew Butler Systems Development Engineer @ Amazon Web Services Luca Liberati Luca Liberati I work on monoliths and microservices, backends and frontends, manage K8s clusters and love to design apps architecture Dor Yaloz Dor Yaloz SW engineer with 6+ years of experience, I worked with React/Node/Python did projects with React+Capacitor.js for ios Supabase expert Jaime Orts-Caroff Jaime Orts-Caroff I'm a Senior Android developer, open to work in various fields Costea Adrian Costea Adrian Embedded Engineer specilizing in perception systems. Latest project was a adas camera calibration system. AUXLE AUXLE I am a Full Stack Developer experienced in building Websites, Web apps and Cross Platform Mobile Apps for Startups and Companies.

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

Is it safe to reset the database in production?

NEVER use prisma migrate reset in production. Use npx prisma migrate deploy instead

How do I add a column without losing data?

Add column with @db.String? (nullable), then update existing records, then make non-nullable

What if a migration is stuck?

Check prisma_migrations table in database. Manually mark it as resolved if data is correct: UPDATE _prisma_migrations SET finished_at = NOW()

Related Bolt 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