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

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.

Matt Butler Matt Butler Software Engineer @ AWS Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : ) Franck Plazanet Franck Plazanet I am a Strategic Engineering Leader with over 8 years of experience building high-availability enterprise systems and scaling high-performing technical teams. My focus is on bridging the gap between complex technology and business growth. Core Expertise: ๐Ÿš€ Leadership: Managing and coaching teams of 15+ engineers, fostering a culture of accountability and continuous improvement. ๐Ÿ—๏ธ Architecture: Enterprise Core Systems, Multi-system Integration (ERP/API/ETL), and Core Database Structure. โ˜๏ธ Cloud & Scale: AWS Expert; architected systems handling 10B+ monthly requests and managing 100k+ SKUs. ๐Ÿ“ˆ Business Impact: Aligning tech strategy with P&L goals to drive $70k+ in monthly recurring revenue. I thrive on "out-of-the-box" thinking to solve complex technical bottlenecks and am always looking for ways to use automation to improve business productivity. legrab legrab I'll fill this later 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. BurnHavoc BurnHavoc Been around fixing other peoples code for 20 years. 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. Pratik Pratik SWE with 15+ years of experience building and maintaining web apps and extensive BE infrastructure Sage Fulcher Sage Fulcher Hey I'm Sage! Im a Boston area software engineer who grew up in South Florida. Ive worked at a ton of cool places like a telehealth kidney care startup that took part in a billion dollar merger (Cricket health/Interwell health), a boutique design agency where I got to work on a ton of exciting startups including a photography education app, a collegiate Esports league and more (Philosophie), a data analytics as a service startup in Cambridge (MA) as well as at Phillips and MIT Lincoln Lab where I designed and developed novel network security visualizations and analytics. I've been writing code and furiously devoted to using computers to make peopleโ€™s lives easier for about 17 years. My degree is in making computers make pretty lights and sounds. Outside of work I love hip hop, the Celtics, professional wrestling, magic the gathering, photography, drumming, and guitars (both making and playing them) Mehdi Ben Haddou Mehdi Ben Haddou - Founder of Chessigma (1M+ users) & many small projects - ex Founding Engineer @Uplane (YC F25) - ex Software Engineer @Amazon and @Booking.com

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