Prisma · tool · fg-0293

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

A migration failed when applied to the shadow database

Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100

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,
  },
})

Affects: prisma migrate dev on PostgreSQL roles without CREATEDB; config location changed in Prisma 7.0

Sources

Have your agent know this before it fails

claude mcp add --transport http footgun https://getfootgun.com/api/mcp