Ran prisma migrate dev and got this error?
The datasource property url is no longer supported in schema files.
Move connection URLs to prisma.config.ts
What changed?
Prisma 7 moved the database URL from schema.prisma to a new file:
prisma.config.ts.
Fix:
Remove url from schema.prisma:
datasource db {
provider = "postgresql"
}
Create prisma.config.ts in your project root:
import 'dotenv/config'
import { defineConfig } from 'prisma/config'
export default defineConfig({
datasource: {
url: process.env.DATABASE_URL!,
},
})
Run npx prisma generate
That's it. Your database URL now lives in the config file, not the schema.
Why? Cleaner separation: models stay in schema.prisma, config goes to prisma.config.ts.

Top comments (0)