Upgrade Prisma ORM to v7
Walks a Prisma ORM 6 project to version 7: the prisma-client generator, prisma.config.ts, driver adapters, ESM, explicit env loading and the features v7 removed. Use when upgrading a SQL project from Prisma 6 or fixing errors right after the upgrade.
prisma-upgrade-v7- Author
- Prisma
- Source
- prisma/skills/prisma-upgrade-v7 @ a6f1929
- License
- MIT · Copyright (c) 2025 Prisma
About this skill
What it does
The skill moves a project from Prisma ORM 6 to 7 in ten steps: update packages, choose ESM (the default) or CommonJS via moduleFormat = "cjs", adjust tsconfig.json, switch the generator from prisma-client-js to prisma-client with an explicit output, create prisma.config.ts, install a driver adapter, fix imports and client construction, replace Prisma.validator with satisfies, then generate and test. The floor is Node.js 20.19.0 and TypeScript 5.4.0.
Seven files in references/ cover each break:
schema-changes.md: generator, output paths,engineType, the newclient,browser,modelsandenumsentrypoints.driver-adapters.md: why SQL providers now need an adapter; setup for PostgreSQL, MySQL, SQLite, SQL Server, Neon and Prisma Postgres; pool and SSL defaults that differ from v6.esm-support.md,prisma-config.md,env-variables.md: module format, the config file,.envloading withdotenv, removed Prisma env variables.removed-features.md:$usemiddleware replaced by Client Extensions, with soft delete and logging as examples; metrics;--skip-generateand--skip-seed; migrate no longer running generate and seed.accelerate-users.md: an Accelerateprisma://URL goes toaccelerateUrl, never to a driver adapter.
When to use it, and when not
Use it for a Prisma 6 SQL project going to 7, or for errors right after that upgrade: "Cannot find module" from an output path that does not match the import, SSL errors, connection timeouts from the new pool defaults.
Not for MongoDB: Prisma 7 has no MongoDB connector, and the skill tells such projects to stay on 6 or move to Prisma 8 with prisma-mongodb-upgrade, a Prisma skill outside our catalog. The skill names 7.6.0 as the latest stable release, while Prisma ORM setup checked its examples on 7.10.0, so look up the current 7.x before pinning.
How to run it
The install command below puts the whole folder in place. The agent picks the skill up when a Prisma 7 upgrade or a v7 error comes up; to call it yourself:
- Claude Code:
/prisma-upgrade-v7, or ask for the skill by name. - Codex:
$prisma-upgrade-v7. - Cursor: type
/in the Agent chat and pickprisma-upgrade-v7.
Example: /prisma-upgrade-v7 Upgrade this Express app from Prisma 6 to 7. We use PostgreSQL, CommonJS and a $use middleware for soft delete.
How it differs from similar skills
Prisma ORM setup also works with Prisma 7, but keeps the version an app already has and sends only the 6-to-7 upgrade here. A PostgreSQL app can go from 6 straight to 8 with prisma-postgres-upgrade, a Prisma skill outside our catalog. Prisma CLI is the command reference once the project is on 7. Outside Prisma's pack nothing in our catalog covers this upgrade: Deprecation and migration is about retiring your own systems and APIs, not a dependency's major version.
Install
Run one command — it saves SKILL.md and the files it uses into your agent's skills folder. Claude Code and Codex pick up a new skill without a restart; if it does not show up, restart the agent.
curl -fsSL --create-dirs -o ~/.claude/skills/prisma-upgrade-v7/SKILL.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/SKILL.md -o ~/.claude/skills/prisma-upgrade-v7/LICENSE https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/LICENSE -o ~/.claude/skills/prisma-upgrade-v7/references/accelerate-users.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/accelerate-users.md -o ~/.claude/skills/prisma-upgrade-v7/references/driver-adapters.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/driver-adapters.md -o ~/.claude/skills/prisma-upgrade-v7/references/env-variables.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/env-variables.md -o ~/.claude/skills/prisma-upgrade-v7/references/esm-support.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/esm-support.md -o ~/.claude/skills/prisma-upgrade-v7/references/prisma-config.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/prisma-config.md -o ~/.claude/skills/prisma-upgrade-v7/references/removed-features.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/removed-features.md -o ~/.claude/skills/prisma-upgrade-v7/references/schema-changes.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/schema-changes.md
curl -fsSL --create-dirs -o ~/.agents/skills/prisma-upgrade-v7/SKILL.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/SKILL.md -o ~/.agents/skills/prisma-upgrade-v7/LICENSE https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/LICENSE -o ~/.agents/skills/prisma-upgrade-v7/references/accelerate-users.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/accelerate-users.md -o ~/.agents/skills/prisma-upgrade-v7/references/driver-adapters.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/driver-adapters.md -o ~/.agents/skills/prisma-upgrade-v7/references/env-variables.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/env-variables.md -o ~/.agents/skills/prisma-upgrade-v7/references/esm-support.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/esm-support.md -o ~/.agents/skills/prisma-upgrade-v7/references/prisma-config.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/prisma-config.md -o ~/.agents/skills/prisma-upgrade-v7/references/removed-features.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/removed-features.md -o ~/.agents/skills/prisma-upgrade-v7/references/schema-changes.md https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/references/schema-changes.md
foreach ($f in 'SKILL.md','LICENSE','references/accelerate-users.md','references/driver-adapters.md','references/env-variables.md','references/esm-support.md','references/prisma-config.md','references/removed-features.md','references/schema-changes.md') { $p = Join-Path "$HOME\.claude\skills\prisma-upgrade-v7" $f; New-Item -ItemType Directory -Force (Split-Path $p) | Out-Null; Invoke-WebRequest "https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/$f" -UseBasicParsing -OutFile $p }foreach ($f in 'SKILL.md','LICENSE','references/accelerate-users.md','references/driver-adapters.md','references/env-variables.md','references/esm-support.md','references/prisma-config.md','references/removed-features.md','references/schema-changes.md') { $p = Join-Path "$HOME\.agents\skills\prisma-upgrade-v7" $f; New-Item -ItemType Directory -Force (Split-Path $p) | Out-Null; Invoke-WebRequest "https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/$f" -UseBasicParsing -OutFile $p }Any other agent: save the file into its skills folder, or give it the link to the file: https://anymodel.org/en/skills/prisma/prisma-upgrade-v7/SKILL.md
SKILL.md
Upgrade to Prisma ORM 7
Complete guide for migrating from Prisma ORM v6 to v7. This upgrade introduces significant breaking changes around the new prisma-client generator, driver adapters, prisma.config.ts, explicit environment loading, and generated client entrypoints.
When to Apply
Reference this skill when:
- Upgrading from Prisma v6 to v7
- Updating to the
prisma-clientgenerator - Setting up driver adapters
- Configuring
prisma.config.ts - Fixing import errors after upgrade
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Schema Migration | CRITICAL | schema-changes |
| 2 | Database Connectivity | CRITICAL | driver-adapters |
| 3 | Module System | CRITICAL | esm-support |
| 4 | Config and Env | HIGH | prisma-config, env-variables |
| 5 | Removed Features | HIGH | removed-features |
| 6 | Accelerate | HIGH | accelerate-users |
Quick Reference
schema-changes- generator migration, required output paths, generated entrypoints, andPrisma.validatorreplacementdriver-adapters- required adapter installation for SQL providers, pool differences, and Prisma Postgres adapter choicesesm-support- ESM-first setup plus CommonJS fallback withmoduleFormat = "cjs"prisma-config- creating and usingprisma.config.tsenv-variables- explicit environment loadingremoved-features- removed middleware, metrics, and legacy CLI behavioraccelerate-users- migration notes for Accelerate users
Using MongoDB? This guide does not apply
Prisma 7 has no MongoDB connector. Do not apply any step in this guide to a project with
provider = "mongodb" — see the prisma-mongodb-upgrade skill for the actual decision
(stay on v6 deliberately vs migrate to Prisma 8).
Important Notes
- MongoDB projects should stay on Prisma 6.x or migrate to Prisma 8 - do not migrate MongoDB apps to Prisma 7's SQL client path (see
prisma-mongodb-upgrade) - Node.js 20.19.0+ required
- TypeScript 5.4.0+ required
- Latest stable Prisma ORM version:
7.6.0
Upgrade Steps Overview
- Update packages to v7
- Choose your module format (
esmby default,cjsif needed) - Update TypeScript configuration
- Update the schema generator block
- Create
prisma.config.ts - Install and configure a driver adapter for SQL providers
- Update Prisma Client imports
- Update client instantiation
- Replace deprecated helper patterns like
Prisma.validator - Run
prisma generateand test
Quick Upgrade Commands
# Update packages
npm install @prisma/client@7
npm install -D prisma@7
# Install a driver adapter (PostgreSQL or Prisma Postgres via direct TCP)
npm install @prisma/adapter-pg pg
# Install dotenv for env loading
npm install dotenv
# Regenerate client
npx prisma generate
Breaking Changes Summary
| Change | v6 | v7 |
|---|---|---|
| Module format | Implicit / mixed | ESM-first, moduleFormat = "cjs" supported |
| Generator provider | prisma-client-js |
prisma-client is the default, while prisma-client-js still exists for legacy setups |
| Output path | Auto (node_modules) | Required explicit |
| Driver adapters | Optional | Required for SQL providers |
| Config file | .env + schema |
prisma.config.ts |
| Env loading | Automatic | Manual (dotenv) |
| Generated entrypoints | Single package export | client, browser, models, enums entrypoints |
| Type-safe query fragments | Prisma.validator() |
TypeScript satisfies |
| Middleware | $use() |
Client Extensions |
| Metrics | Preview feature | Removed |
Rule Files
Detailed migration guides for each breaking change:
references/esm-support.md - ESM and CommonJS configuration
references/schema-changes.md - Generator, output, imports, and generated entrypoints
references/driver-adapters.md - Required driver adapter setup
references/prisma-config.md - New configuration file
references/env-variables.md - Environment variable loading
references/removed-features.md - Middleware, metrics, and CLI flags
references/accelerate-users.md - Special handling for Accelerate
Step-by-Step Migration
1. Update package.json for ESM-first projects
{
"type": "module"
}
If you need to stay on CommonJS, keep your app as CJS and set moduleFormat = "cjs" in the generator block instead of forcing ESM.
2. Update tsconfig.json
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"target": "ES2023",
"strict": true,
"esModuleInterop": true
}
}
3. Update schema.prisma
// Before (v6)
generator client {
provider = "prisma-client-js"
}
// After (v7)
generator client {
provider = "prisma-client"
output = "../generated/prisma"
// Optional if you need CommonJS:
// moduleFormat = "cjs"
}
4. Create prisma.config.ts
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'
export default defineConfig({
schema: 'prisma/schema.prisma',
migrations: {
path: 'prisma/migrations',
},
datasource: {
url: env('DATABASE_URL'),
},
})
5. Install a driver adapter (SQL providers only)
# PostgreSQL
npm install @prisma/adapter-pg pg
# MySQL
npm install @prisma/adapter-mariadb mariadb
# SQLite
npm install @prisma/adapter-better-sqlite3 better-sqlite3
# Prisma Postgres in standard Node.js apps (recommended)
npm install @prisma/adapter-pg pg
# Prisma Postgres serverless driver (edge/serverless)
npm install @prisma/adapter-ppg @prisma/ppg
# Neon
npm install @prisma/adapter-neon
MongoDB does not have a SQL @prisma/adapter-* package in the published Prisma 7.6.0 packages. If you're upgrading a MongoDB project, stop and keep that project on the latest Prisma 6.x release instead of following the standard Prisma 7 migration path.
6. Update client instantiation
// Before (v6)
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
// After (v7)
import { PrismaClient } from '../generated/prisma/client'
import { PrismaPg } from '@prisma/adapter-pg'
const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL
})
const prisma = new PrismaClient({ adapter })
7. Replace Prisma.validator with satisfies
import { Prisma } from '../generated/prisma/client'
const userSelect = {
id: true,
email: true,
name: true,
} satisfies Prisma.UserSelect
8. Run migrations and generate
npx prisma generate
npx prisma migrate dev # if needed
Troubleshooting
"Cannot find module" errors
- Check that the generator
outputpath matches your import path - Ensure
prisma generateran successfully
SSL certificate errors
- Add
ssl: { rejectUnauthorized: false }to the adapter config if you need to preserve old behavior - Or configure your certificates properly with
NODE_EXTRA_CA_CERTS/ OpenSSL CA settings
Connection timeout issues
- Driver adapters use the underlying driver's defaults, which differ from v6
- Configure pool settings explicitly on the adapter if needed
Resources
How to Use
Follow references/schema-changes.md and references/driver-adapters.md first, then apply the remaining reference files based on your project setup.
Connect through AnyModel API
This skill runs on whatever model your agent uses. Point Claude Code, Codex or Cursor at AnyModel to run it on Claude, GPT, Gemini and more with one key — pay per token, no subscription.
AnyModel