Generated banner for Prisma Upgrade V7
Generated logo for Prisma Upgrade V7

Prisma Upgrade V7

PrismaOfficialCreated by prisma

  • Skill
  • Workflow
  • Software development
  • MIT
  • No issues found

From the author

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".
— the description by prisma

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured migration path for upgrading Prisma ORM from version 6 to 7. It addresses critical breaking changes, including the move to an ESM-first architecture, the introduction of the prisma.config.ts file, and the mandatory requirement of driver adapters for SQL-based database connections. The guide covers package updates, schema generator modifications, environment variable handling, and client instantiation updates. Note that this migration path is strictly for SQL-based projects; MongoDB users are advised to remain on Prisma 6.x or consider alternative upgrade paths.

What it does

  • Provides step-by-step instructions for upgrading Prisma packages to v7.
  • Guides the configuration of driver adapters for various SQL databases.
  • Details the transition to the new prisma.config.ts file format.
  • Explains how to update TypeScript configurations for ESM compatibility.
  • Outlines the replacement of deprecated patterns like Prisma.validator.
  • Offers specific guidance for users of Prisma Accelerate.

When to use it

  • When upgrading an existing project from Prisma ORM v6 to v7.
  • When encountering errors related to Prisma v7 breaking changes.
  • When configuring new driver adapters for SQL database connectivity.
  • When setting up the required prisma.config.ts file.

Advantages

  • Ensures a systematic approach to handling critical breaking changes.
  • Reduces manual effort by providing clear configuration templates.
  • Provides specific paths for both standard SQL and Accelerate-based setups.
  • Helps avoid common pitfalls like incorrect import paths or missing adapters.

Usage examples

“How do I upgrade my project to Prisma 7?”
The agent provides the full migration workflow, starting with package updates, schema generator changes, and the installation of the appropriate driver adapter.
“I am getting errors after upgrading to Prisma 7, what should I check?”
The agent guides you through verifying your prisma.config.ts, checking your driver adapter implementation, and ensuring your import paths match the new generated client structure.
“How do I configure a driver adapter for PostgreSQL in Prisma 7?”
The agent provides the specific npm installation command and the TypeScript code snippet to instantiate the PrismaClient with the PrismaPg adapter.
“Can I use this guide to migrate my MongoDB project to Prisma 7?”
The agent clarifies that Prisma 7 does not support MongoDB and advises keeping the project on Prisma 6.x.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/prisma/prisma-upgrade-v7/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip prisma-upgrade-v7.zip -d .agents/skills

Documentation by prisma

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-client generator

  • Setting up driver adapters

  • Configuring prisma.config.ts

  • Fixing import errors after upgrade

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Schema MigrationCRITICALschema-changes
2Database ConnectivityCRITICALdriver-adapters
3Module SystemCRITICALesm-support
4Config and EnvHIGHprisma-config, env-variables
5Removed FeaturesHIGHremoved-features
6AccelerateHIGHaccelerate-users

Quick Reference

  • schema-changes - generator migration, required output paths, generated entrypoints, and Prisma.validator replacement

  • driver-adapters - required adapter installation for SQL providers, pool differences, and Prisma Postgres adapter choices

  • esm-support - ESM-first setup plus CommonJS fallback with moduleFormat = "cjs"

  • prisma-config - creating and using prisma.config.ts

  • env-variables - explicit environment loading

  • removed-features - removed middleware, metrics, and legacy CLI behavior

  • accelerate-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

  1. Update packages to v7

  2. Choose your module format (esm by default, cjs if needed)

  3. Update TypeScript configuration

  4. Update the schema generator block

  5. Create prisma.config.ts

  6. Install and configure a driver adapter for SQL providers

  7. Update Prisma Client imports

  8. Update client instantiation

  9. Replace deprecated helper patterns like Prisma.validator

  10. Run prisma generate and 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

Changev6v7
Module formatImplicit / mixedESM-first, moduleFormat = "cjs" supported
Generator providerprisma-client-jsprisma-client is the default, while prisma-client-js still exists for legacy setups
Output pathAuto (node_modules)Required explicit
Driver adaptersOptionalRequired for SQL providers
Config file.env + schemaprisma.config.ts
Env loadingAutomaticManual (dotenv)
Generated entrypointsSingle package exportclient, browser, models, enums entrypoints
Type-safe query fragmentsPrisma.validator()TypeScript satisfies
Middleware$use()Client Extensions
MetricsPreview featureRemoved

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 output path matches your import path

  • Ensure prisma generate ran 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.

Files

references/driver-adapters.md

Driver Adapters

These examples apply to Prisma ORM 7 SQL clients during a 6-to-7 upgrade. They do not configure Prisma 8; use the installed package-owned prisma-8 runtime guidance for that version.

MongoDB should not follow this path. There is no published MongoDB @prisma/adapter-* package, and MongoDB projects should remain on the latest Prisma 6.x release instead of trying to fit into the Prisma 7 SQL adapter model.

Why Driver Adapters?

  • No native engine binary in the Prisma Client SQL path

  • Smaller bundle size

  • Better serverless/edge compatibility

  • Uses native Node.js database drivers

  • More control over connection pooling

Available Adapters

DatabaseAdapter PackageUnderlying Driver
PostgreSQL@prisma/adapter-pgpg
MySQL / MariaDB@prisma/adapter-mariadbmariadb
SQLite@prisma/adapter-better-sqlite3better-sqlite3
Prisma Postgres (Node.js)@prisma/adapter-pgpg
Prisma Postgres (edge/serverless)@prisma/adapter-ppg@prisma/ppg
SQL Server@prisma/adapter-mssqlmssql
Neon@prisma/adapter-neon@neondatabase/serverless
PlanetScale@prisma/adapter-planetscale@planetscale/database
Turso/libSQL@prisma/adapter-libsql@libsql/client
D1 (Cloudflare)@prisma/adapter-d1Cloudflare D1

Installation

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-pg pg
SQL Server
npm install @prisma/adapter-mssql mssql

Configuration

PostgreSQL
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 })
MySQL
import { PrismaClient } from '../generated/client'
import { PrismaMariaDb } from '@prisma/adapter-mariadb'

const adapter = new PrismaMariaDb({
  host: 'localhost',
  port: 3306,
  connectionLimit: 5,
  user: process.env.MYSQL_USER,
  password: process.env.MYSQL_PASSWORD,
  database: process.env.MYSQL_DATABASE,
})

const prisma = new PrismaClient({ adapter })
SQLite
import { PrismaClient } from '../generated/client'
import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3'

const adapter = new PrismaBetterSqlite3({
  url: process.env.DATABASE_URL || 'file:./dev.db'
})

const prisma = new PrismaClient({ adapter })
Neon (Serverless PostgreSQL)
import { PrismaClient } from '../generated/client'
import { PrismaNeon } from '@prisma/adapter-neon'

const adapter = new PrismaNeon({
  connectionString: process.env.DATABASE_URL
})

const prisma = new PrismaClient({ adapter })
Prisma Postgres
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 })
Prisma Postgres serverless driver
import { PrismaClient } from '../generated/client'
import { PrismaPostgresAdapter } from '@prisma/adapter-ppg'

const prisma = new PrismaClient({
  adapter: new PrismaPostgresAdapter({
    connectionString: process.env.PRISMA_DIRECT_TCP_URL,
  }),
})
SQL Server
import { PrismaClient } from '../generated/client'
import { PrismaMssql } from '@prisma/adapter-mssql'

const adapter = new PrismaMssql({
  server: 'localhost',
  port: 1433,
  database: 'mydb',
  user: process.env.SQLSERVER_USER,
  password: process.env.SQLSERVER_PASSWORD,
  options: {
    encrypt: true,
    trustServerCertificate: true,
  },
})

const prisma = new PrismaClient({ adapter })

Connection Pool Configuration

Driver adapters use the underlying driver's pool settings, which differ from v6 defaults.

PostgreSQL with custom pool
import { PrismaPg } from '@prisma/adapter-pg'

const adapter = new PrismaPg({
  connectionString: process.env.DATABASE_URL,
  // Pool configuration
  max: 10,                    // Maximum connections
  idleTimeoutMillis: 30000,   // Close idle connections after 30s
  connectionTimeoutMillis: 5000, // Connection timeout (v6 default was 5s)
})
Matching v6 behavior
const adapter = new PrismaPg({
  connectionString: process.env.DATABASE_URL,
  connectionTimeoutMillis: 5000,  // v6 used 5 second timeout
})

SSL Configuration

Accept self-signed certificates
const adapter = new PrismaPg({
  connectionString: process.env.DATABASE_URL,
  ssl: {
    rejectUnauthorized: false  // Accept self-signed certs
  }
})
Proper SSL configuration
const adapter = new PrismaPg({
  connectionString: process.env.DATABASE_URL,
  ssl: {
    ca: fs.readFileSync('/path/to/ca-cert.pem'),
    rejectUnauthorized: true
  }
})

Migration from v6

Before (v6)
import { PrismaClient } from '@prisma/client'

const prisma = new PrismaClient({
  datasources: {
    db: { url: process.env.DATABASE_URL }
  }
})
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 })

Singleton Pattern

// lib/prisma.ts
import { PrismaClient } from '../generated/client'
import { PrismaPg } from '@prisma/adapter-pg'

const globalForPrisma = globalThis as unknown as {
  prisma: PrismaClient | undefined
}

const adapter = new PrismaPg({
  connectionString: process.env.DATABASE_URL!
})

export const prisma = globalForPrisma.prisma ?? new PrismaClient({ adapter })

if (process.env.NODE_ENV !== 'production') {
  globalForPrisma.prisma = prisma
}

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Node.js

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
prisma
Publisher
Prisma (Official)
Source
prisma/skills · prisma-upgrade-v7 · commit 8ea289b
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by prisma.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download prisma-upgrade-v7.zip