Prisma · tool · fg-0293

prisma migrate dev on a managed database fails with 'permission denied to create database'

If you see A migration failed when applied to the shadow database, the cause and the fix for Prisma are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
A migration failed when applied to the shadow databaseDatabase error: Error querying the database: db error: ERROR: permission denied to create database
Cause
migrate dev creates and drops a temporary shadow database to replay migrations, which needs CREATEDB or superuser on PostgreSQL. Many hosted databases do not grant it.
Fix
Create a separate empty database for the shadow and point shadowDatabaseUrl at it, never at the main database. In Prisma 7 the setting lives in prisma.config.ts.
Apply
export default defineConfig({ schema: 'prisma/schema.prisma', datasource: { url: process.env.DATABASE_URL, shadowDatabaseUrl: process.env.SHADOW_DATABASE_URL, }, })
Affected
prisma migrate dev on PostgreSQL roles without CREATEDB; config location changed in Prisma 7.0
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun