Prisma Error P3019: Datasource Provider Mismatch

Prisma error P3019 (Datasource Provider Mismatch) explained: what it means, why it happens, and how to fix it — with copy-paste code examples.

Error code P3019 Prisma Last verified 2026-08-19

Quick Answer

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

Error code: P3019
Official name: Datasource Provider Mismatch
Service: Prisma

What does this error mean?

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

Common Causes

How to Fix

  1. Open prisma/migrations/migration_lock.toml and compare its provider line with schema.prisma
  2. If the change is intentional: regenerate the migration baseline or start fresh with a new migrations folder
  3. If it is a copy/paste mistake: revert the provider in schema.prisma back to what migration_lock.toml says
  4. Delete stale migration folders only when you are certain no environment has applied them
  5. Run `npx prisma migrate dev` and confirm the lock file is recreated with the correct provider

Code Examples

Inspect the lock file toml
# prisma/migrations/migration_lock.toml
provider = "postgresql"

The provider recorded when the migration history started. New migrations must use the same provider.

Align the datasource prisma
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.

Framework-Specific Fixes

prisma-cli

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
github-actions

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
nestjs

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

You Might Also Like

Frequently Asked Questions

Why am I seeing Prisma error P3019?

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.

How do I fix Prisma error P3019?

Open prisma/migrations/migration_lock.toml and compare its provider line with schema.prisma.

Which frameworks have documented fixes for error P3019?

This page documents fixes for: prisma-cli, github-actions, nestjs.

Official Sources

This page is based on the official Prisma documentation linked below and adds practical troubleshooting guidance on top.