Solution skill
Prisma 7 breaking changes to Prisma config file, and prisma schema
Complete solution
Fixes Prisma 7 breaking changes: the P1012 error 'The datasource property url is no longer supported in schema files' and seed failures, by moving config to prisma.config.ts with an explicit adapter. Use when upgrading to Prisma 7 breaks prisma generate, migrate deploy, or seeding. Not for Prisma 5/6 config issues.
When it applies
Not specified by the original author.
Instructions
TL;DR
Prisma 7 moved configuration out of schema.prisma into prisma.config.ts. Fix the P1012 validation error by removing url from the datasource block in your schema and defining it in prisma.config.ts instead. If seeding fails with "Cannot read properties of undefined", add an explicit database adapter in prisma.config.ts because Prisma 7 no longer auto-detects the provider.
The error
npx prisma generate
Loaded Prisma config from prisma.config.ts. Prisma schema loaded from prisma/schema.prisma
Error: Prisma schema validation - (get-config wasm)
Error code: P1012
error: The datasource property `url` is no longer supported in schema files.Related failure on migrate deploy in Docker:
error: The datasource property `url` is required in your Prisma config fileFix it
Remove
urlfrom the datasource block inprisma/schema.prisma. Success check:npx prisma validateno longer reports P1012.Define the datasource URL in
prisma.config.ts:import { defineConfig } from "prisma/config"; export default defineConfig({ datasource: { url: process.env.DATABASE_URL }, });Success check:
npx prisma generatecompletes without validation errors.If seeding fails with "Cannot read properties of undefined (__internal)", add an explicit adapter in
prisma.config.ts(Prisma 7 no longer auto-detects the provider):import { PrismaPg } from "@prisma/adapter-pg"; export default defineConfig({ datasource: { url: process.env.DATABASE_URL }, // adapter wiring per your database driver });Success check:
prisma db seedruns without the undefined-property error.For Docker multi-stage builds, make sure
prisma.config.tsis copied into the final image. Success check:prisma migrate deployin the container finds the config and connects.
When this applies
- Upgrading to Prisma 7 (from 5 or 6) breaks
prisma generate,migrate deploy, ordb seed. - You see P1012 about the datasource
urlproperty, or "required in your Prisma config file".
When it does not apply
- You are on Prisma 5 or 6; the old schema-based config still works there.
- The error is a different P-code (e.g. P1001 connection refused); that is a database reachability problem.
engine: 'classic'errors on Prisma 7: the classic engine no longer exists; use the library engine default.
Compatibility
- Prisma 7.x (breaking change introduced in 7.0). Prisma 5/6 unaffected.
- Node.js 18+. Docker multi-stage builds need the config file in the final stage.
Variant phrasings
- error: prisma schema validation - (get-config wasm) error code: p1012
- The datasource property url is no longer supported in schema files
- Prisma 7 "datasource property url is required in your Prisma config file"
- Prisma 7 seed "Cannot read properties of undefined"
Why it happens
Prisma 7 extracted all connection configuration from the schema file into prisma.config.ts, so the schema url property was removed and validation rejects it (P1012). The same move means the provider is no longer inferred from the schema datasource, so seeding needs an explicit adapter. Docker builds break when the new config file is not copied into the runtime image.
Edge cases
engine: 'classic'in config: the classic engine was removed; delete the setting and use the default.- Monorepos: each Prisma schema needs its own
prisma.config.tsor a shared config with per-schema datasource overrides. - Source: https://github.com/prisma/orm/issues/28573
Evidence
In the GitHub issue gh:prisma/orm#28573 (https://github.com/prisma/orm/issues/28573), the problem reported was: Issue prisma/orm#28573 (closed, 73 comments): When upgrading to the latest version of prisma, i am getting issues with the config file saying engine:'classic' engine doesnt exist, then on project build i am getting an error saying the url in the db source block is deprecated but when removing it i get and error saying it is required to be added. [image] npx prisma generate Loaded Prisma config from prisma.config.ts. Prisma schema loaded from prisma\schema.prisma Error: Prisma schema validation - (get-config wasm) Error code: P1012 error: The datasource property url` is no longer supported in schema files. The verified resolution was: [nonacc / otsairaze (commenters)]: Prisma 7 moved config out of schema.prisma into prisma.config.ts, which breaks two things. (1) Seeding fails with "Cannot read properties of undefined (__internal)" because Prisma 7 no longer auto-detects the database provider: add an explicit adapter in prisma.config.ts. (2) In Docker multi-stage builds, make sure prisma.config.ts is copied into the final image, or migrate deploy fails with "The datasource property is required in your Prisma config file".
By @issueatlas · Version 2 · Exact version
Maintainer review
Checking maintainer review for this exact version…
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_biwQKc_bojc8jhEJxWJKcg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Prisma 7 breaking changes to Prisma config file, and prisma schema <span>— Vectle</span></a>