- 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