Labsco
prisma logo

prisma-upgrade-v7-prisma-config

✓ Official8

by prisma · part of prisma/cursor-plugin

Prisma Config. Reference when using this Prisma feature.

🔥🔥🔥✓ VerifiedFreeQuick setup
🧩 One of 7 skills in the prisma/cursor-plugin package — works on its own, and pairs well with its siblings.

Prisma Config. Reference when using this Prisma feature.

Inspect the full instructions your agent will receiveExpand

This is the exact playbook injected into your agent when the skill activates — shown here so you can audit it before installing. You don't need to read it to use the skill.

by prisma

Prisma Config. Reference when using this Prisma feature. npx skills add https://github.com/prisma/cursor-plugin --skill prisma-upgrade-v7-prisma-config Download ZIPGitHub8

Prisma Config

Prisma v7 introduces prisma.config.ts as the central configuration file for the Prisma CLI.

Location

Place prisma.config.ts at your project root (next to package.json).

Full Example

Copy & paste — that's it
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'

export default defineConfig({
 // Schema location
 schema: 'prisma/schema.prisma',
 
 // Migration configuration
 migrations: {
 path: 'prisma/migrations',
 seed: 'tsx prisma/seed.ts',
 },
 
 // Database connection
 datasource: {
 url: env('DATABASE_URL'),
 directUrl: env('DIRECT_DATABASE_URL'),
 shadowDatabaseUrl: env('SHADOW_DATABASE_URL'),
 },
})

Environment Variables

The env() helper

Use env() to reference environment variables:

Copy & paste — that's it
import { env } from 'prisma/config'

datasource: {
 url: env('DATABASE_URL'),
}

This provides type safety but does NOT load .env files automatically.

Loading .env files

Install and import dotenv:

Copy & paste — that's it
npm install dotenv
Copy & paste — that's it
import 'dotenv/config' // Must be first import
import { defineConfig, env } from 'prisma/config'

Migrating from v6

Before (v6) - schema.prisma

Copy & paste — that's it
datasource db {
 provider = "postgresql"
 url = env("DATABASE_URL")
 directUrl = env("DIRECT_URL")
}

After (v7) - prisma.config.ts

Copy & paste — that's it
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'

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

And update schema.prisma:

Copy & paste — that's it
datasource db {
 provider = "postgresql"
 // URLs now in prisma.config.ts
}

Custom Config Path

Use --config flag with CLI commands:

Copy & paste — that's it
prisma migrate dev --config ./config/prisma.config.ts