Prisma "Drift detected: your database schema is not in sync" in CI
Drift means the actual database schema differs from what the applied migrations describe. Something changed the database outside of Prisma Migrate, so the recorded history no longer matches reality.
What this error means
A migrate step (dev or a status check) reports "Drift detected: Your database schema is not in sync with your migration history" and lists the differing objects.
Prisma
Drift detected: Your database schema is not in sync with your migration history.
The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.
[+] Added tables
- audit_logCommon causes
Manual changes outside migrations
A table, column, or index was created directly on the database, so it is not represented in any migration.
A different migration set applied to a shared DB
Another branch or environment applied migrations to the same database, leaving it out of sync with this branch history.
How to fix it
Reconcile with a migration
- Capture the out-of-band change as a new migration, or revert it.
- For a disposable CI database, reset so it matches history exactly.
- Never hand-edit shared databases outside Prisma Migrate.
Terminal
# ephemeral CI DB: make it match migration history
npx prisma migrate reset --forceDetect drift as a gate
Run a status check so drift fails fast instead of surprising a later deploy.
Terminal
npx prisma migrate statusHow to prevent it
- Make all schema changes through Prisma Migrate.
- Use a fresh database per CI run to avoid shared drift.
- Add a
migrate statuscheck to catch drift early.
Related guides
Prisma "migrate dev" prompts and fails in CI (use migrate deploy)Fix Prisma migrate hanging or failing in CI because `migrate dev` was used - it is interactive and may reset.…
Prisma "P3005: The database schema is not empty" (baseline) in CIFix Prisma "P3005: The database schema is not empty" in CI - migrate deploy hit an existing schema with no mi…
Prisma "prisma db push" schema sync fails in CIFix "prisma db push" failures in CI - the command force-syncs schema.prisma to the database and can warn abou…