Awesome-omni-skill prisma-upgrade-v7
Complete migration guide from Prisma ORM v6 to v7 covering all breaking changes. Use when upgrading Prisma versions, encountering v7 errors, or migrating existing projects. Triggers on "upgrade to prisma 7", "prisma 7 migration", "prisma-client generator", "driver adapter required".
install
source · Clone the upstream repo
git clone https://github.com/diegosouzapw/awesome-omni-skill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/tools/prisma-upgrade-v7-yeohj0710" ~/.claude/skills/diegosouzapw-awesome-omni-skill-prisma-upgrade-v7-ddecfe && rm -rf "$T"
manifest:
skills/tools/prisma-upgrade-v7-yeohj0710/SKILL.mdsource content
Upgrade to Prisma ORM 7
Complete guide for migrating from Prisma ORM v6 to v7. This upgrade introduces significant breaking changes including ESM-only support, required driver adapters, and a new configuration system.
When to Apply
Reference this skill when:
- Upgrading from Prisma v6 to v7
- Updating to the
generatorprisma-client - 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 | |
| 2 | Database Connectivity | CRITICAL | |
| 3 | Module System | CRITICAL | |
| 4 | Config and Env | HIGH | , |
| 5 | Removed Features | HIGH | |
| 6 | Accelerate | HIGH | |
Quick Reference
- generator and output migration for Prisma v7schema-changes
- required adapter installation and client wiringdriver-adapters
- package/module requirements for ESMesm-support
- creating and usingprisma-configprisma.config.ts
- explicit environment loadingenv-variables
- removed middleware, metrics, and flagsremoved-features
- migration notes for Accelerate usersaccelerate-users
Important Notes
- MongoDB not yet supported in v7 - Continue using v6 for MongoDB
- Node.js 20.19.0+ required
- TypeScript 5.4.0+ required
Upgrade Steps Overview
- Update packages to v7
- Configure ESM in package.json
- Update TypeScript configuration
- Update schema generator block
- Create prisma.config.ts
- Install and configure driver adapter
- Update Prisma Client imports
- Update client instantiation
- Remove deprecated code (middleware, env vars)
- Run generate and test
Quick Upgrade Commands
# Update packages npm install @prisma/client@7 npm install -D prisma@7 # Install driver adapter (PostgreSQL example) npm install @prisma/adapter-pg # Install dotenv for env loading npm install dotenv # Regenerate client npx prisma generate
Breaking Changes Summary
| Change | v6 | v7 |
|---|---|---|
| Module format | CommonJS | ESM only |
| Generator provider | | |
| Output path | Auto (node_modules) | Required explicit |
| Driver adapters | Optional | Required |
| Config file | + schema | |
| Env loading | Automatic | Manual (dotenv) |
| Middleware | | Client Extensions |
| Metrics | Preview feature | Removed |
Rule Files
Detailed migration guides for each breaking change:
references/esm-support.md - ESM module configuration references/schema-changes.md - Generator and schema updates 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
{ "type": "module" }
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" }
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 driver adapter
# PostgreSQL npm install @prisma/adapter-pg # MySQL npm install @prisma/adapter-mariadb mariadb # SQLite npm install @prisma/adapter-better-sqlite3 # Prisma Postgres npm install @prisma/adapter-ppg @prisma/ppg # Neon npm install @prisma/adapter-neon
6. Update client instantiation
// Before (v6) import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() // After (v7) import { PrismaClient } from '../generated/client' import { PrismaPg } from '@prisma/adapter-pg' const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL }) const prisma = new PrismaClient({ adapter })
7. Run migrations and generate
npx prisma generate npx prisma migrate dev # if needed
Troubleshooting
"Cannot find module" errors
- Check
path in generator block matches import pathoutput - Ensure
ran successfullyprisma generate
SSL certificate errors
- Add
to adapter configssl: { rejectUnauthorized: false } - Or properly configure SSL certificates
Connection timeout issues
- Driver adapters use different pool defaults
- Configure pool settings explicitly on the adapter
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.