Search code examples
postgresqlprismasupabase

Prisma migration fail with supabase


I'm trying to generate some migrations using Prisma.
I'm using Supabase which is using Postgres under the hood.
Also, I tried to run the following command with the local emulator and with the "real project".

When I run prisma db push it's working, so the communication between prisma and supabase can be established. But when I try to run prisma migrate dev I get the following error

Error: db error: ERROR: no such database: prisma_migrate_shadow_db_b2ce3e4e-c5ef-41f6-830f-2203a082f1db
   0: sql_migration_connector::flavour::postgres::sql_schema_from_migration_history
             at migration-engine/connectors/sql-migration-connector/src/flavour/postgres.rs:367
   1: migration_core::api::DevDiagnostic
             at migration-engine/core/src/api.rs:108

Supabase CLI : 0.15.3
Prisma : 3.6.0


Solution

  • I also asked this question on Prisma repo : https://github.com/prisma/prisma/issues/10575

    The solution is to create a shadow database as mentionned in the documentation https://www.prisma.io/docs/concepts/components/prisma-migrate/shadow-database#cloud-hosted-shadow-databases-must-be-created-manually