Prisma error P3019 (Datasource Provider Mismatch) explained: what it means, why it happens, and how to fix it — with copy-paste code examples.
Open prisma/migrations/migration_lock.toml and compare its provider line with schema.prisma. If that does not apply, if the change is intentional: regenerate the migration baseline or start fresh with a new migrations folder — the full checklist is below.
Error code: P3019
Official name: Datasource Provider Mismatch
Service: Prisma
The datasource provider {provider} specified in your schema does not match the one specified in the migration_lock.toml, {expected_provider}. Please remove your current migration directory and start a new migration history with prisma migrate dev. Read more: https://pris.ly/d/migrate-provider-switch
# prisma/migrations/migration_lock.toml
provider = "postgresql"
The provider recorded when the migration history started. New migrations must use the same provider.
datasource db {
provider = "postgresql" // must match migration_lock.toml
url = env("DATABASE_URL")
}
Keeping provider identical in both files avoids P3019. Changing providers intentionally requires regenerating the baseline.
The lock file wins for existing migrations; align the datasource with it or rebuild the baseline.
# prisma/migrations/migration_lock.toml
provider = "postgresql"
# schema.prisma datasource provider must match
Fail the build early if provider drift is detected between schema and lock file.
- run: grep 'provider' prisma/migrations/migration_lock.toml
- run: grep 'provider' prisma/schema.prisma
Pin the provider in documentation and PR checklists; a provider switch is a project-level decision, not an edit.
# CONTRIBUTING.md: changing the database provider requires
# regenerating migrations and updating migration_lock.toml together
Most often this happens when the provider in schema.prisma (e.g. postgresql) does not match migration_lock.toml (e.g. mysql), or when switching a project from MySQL to PostgreSQL without regenerating migrations.
Open prisma/migrations/migration_lock.toml and compare its provider line with schema.prisma.
This page documents fixes for: prisma-cli, github-actions, nestjs.
Recommendations are editorial — DB Error Reference takes no payment or affiliate fees for tool listings.
This page is based on the official Prisma documentation linked below and adds practical troubleshooting guidance on top.