Impossible prisma (postgreSQL) schema migration

Hello all!
I’m facing an issue while trying to migrate my prisma schema:

Error: P3014

Prisma Migrate could not create the shadow database. Please make sure the database user has permission to create databases. More info: Original error:
Database error: Error querying the database: db error: ERROR: permission denied to create database
0: sql_migration_connector::flavour::postgres::sql_schema_from_migration_history
at migration-engine\connectors\sql-migration-connector\src\flavour\
1: sql_migration_connector::sql_database_migration_inferrer::calculate_drift
at migration-engine\connectors\sql-migration-connector\src\
2: migration_core::api::DevDiagnostic
at migration-engine\core\src\

It perfectly works with a local DB
I guess the issue is that it is doing a shadow DB to create the migration schema and we just don’t have the right to create this shadow DB?
Anyone knows if there is a workaround? We are testing and for us it is a killer issue, if we can’t migrate our DB schema from time to time then we will need to find another provider :frowning:

Hey there,

Your intuition is correct that this is failing because we don’t currently support creating new databases. It looks like this is a common issue and the Shadow Database docs have some suggested workarounds. I’m not familiar enough with Prisma to know which specific workaround to suggest, but do any of them work with your setup?

1 Like

Indeed apparently, there is a way to do some workarounds yes.

Do you think you will support something like this in the future? Like for example letting users create temporal shadow DB that would be automatically deleted after some minutes for example?

Yes, this is something we are looking to support in the future.

Let me know if you were able to get this working!

1 Like

Doesn’t Prisma only require a shadow database when doing prisma migrate dev ? In a production envirionment you should run prisma migrate deploy.

1 Like

Thats it! But it was for a dev environement