VectleSkillsthe datasource.url property is required in your prisma config file when using prisma migrate deploy

the datasource.url property is required in your prisma config file when using prisma migrate deploy

Export

Fixes the Prisma 7 error 'the datasource.url property is required in your prisma config file when using prisma migrate deploy' by adding a datasource url entry to prisma.config.ts at the project root and copying that file into Docker images. Use when the migrate deploy CLI fails with this exact message on Prisma 7. Not for Prisma 6 or earlier, and not for missing DATABASE_URL environment variable errors.

TL;DR: Add a datasource url entry to prisma.config.ts at your project root, pointed at your real database URL, then re-run npx prisma migrate deploy. If you deploy with Docker, copy prisma.config.ts into the image too. This happens because Prisma 7 moved the CLI connection string out of schema.prisma into the config file, so the migrate CLI refuses to run without it.

Error: the datasource.url property is required in your prisma config file when using prisma migrate deploy

Steps

  1. Create prisma.config.ts at the project root (not inside the prisma folder):
   import { defineConfig, env } from 'prisma/config'
   import 'dotenv/config'

   export default defineConfig({
     schema: 'prisma/schema.prisma',
     datasource: { url: env('DATABASE_URL') },
   })

Expected: npx prisma validate prints that the schema is valid and that it loaded the Prisma config.

  1. Docker users: copy the config file into the image next to the prisma folder:
   COPY prisma.config.ts ./
   COPY prisma ./prisma

Expected: the deploy container finds the config; the error disappears from the container logs.

  1. Re-run the deploy:
   npx prisma migrate deploy

Expected: All migrations have been successfully applied. or No pending migrations to apply.

When to use

  • You hit this exact error on prisma migrate deploy, migrate dev, or db push with Prisma 7 or later
  • You upgraded from Prisma 5/6 and removed url from the datasource block

When not to use

  • Prisma 6 or earlier: there the URL still lives in schema.prisma and this error does not exist
  • The failure is Environment variable not found: DATABASE_URL instead: that is a different fix (the env var itself is missing)

Compatibility

Prisma 7.x CLI. Node 18+. Applies to migrate deploy, migrate dev, and db push.

Variant phrasing: same error on db push

db push reads the same config file, so the fix is identical.

Why it happens

Prisma 7 rejects url inside the datasource block of schema.prisma and expects the CLI connection string in prisma.config.ts instead. As a side effect, once the config file exists the CLI stops auto-loading .env on its own, which is why the config needs the dotenv/config import to keep working locally.

Edge cases

  • Wrong location: Prisma looks for prisma.config.ts at the project root (and parent dirs), not prisma/config.ts.
  • env() comes from prisma/config; process.env.DATABASE_URL works too, but env() is the documented form.
  • If you see Prisma config detected, skipping environment variable loading, that is expected Prisma 7 behavior, not an error.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=the+datasource.url+property+is+required+in+your+prisma+config+file+when+using+prisma+migrate+deploy&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.