How to Upgrade Prisma 6 to 7 (Step by Step)

A step-by-step Prisma 6 to 7 upgrade: ESM, the new prisma-client generator, prisma.config.ts, driver adapters, removed middleware and CLI flags, SSL and pool fixes, and a checklist. Prisma ORM 6 support ends 19 November 2026.

Ask ChatGPTAsk Claude
Cover showing Prisma 6 support ends, with a large 19 Nov date and short support facts
On this page
  1. Where Prisma 6, 7 and 8 stand
  2. What changes from Prisma 6 to 7?
  3. Step 1: Check Node.js and TypeScript
  4. Step 2: Install Prisma 7 packages
  5. Step 3: Switch the project to ESM
  6. Step 4: Update the generator block
  7. Step 5: Create prisma.config.ts
  8. Step 6: Create the client with a driver adapter
  9. Step 7: Generate, migrate and seed explicitly
  10. Breaking changes and how to fix each
  11. Middleware (prisma.$use) is removed
  12. Metrics are removed
  13. Connection timeouts behave differently
  14. SSL errors: P1010 after upgrading
  15. Removed CLI flags
  16. Removed environment variables
  17. Mapped enums
  18. Prisma Accelerate
  19. How do I verify the upgrade?
  20. Prisma 6 to 7 upgrade checklist
  21. Does anything stop working on 19 November?

Upgrading Prisma 6 to 7 is a one-afternoon job for most apps, but it is not a version bump. Prisma ORM 7 ships as an ES module, generates the client into your source tree instead of node_modules, moves the database URL into prisma.config.ts, and needs a driver adapter for every database. The CLI also stops running generate and seed for you.

The deadline is real: Prisma ORM 6 receives security patches only until 19 November 2026, according to Prisma's release-status page. Below is the upgrade in order, with the commands, the code changes and the fix for each breaking change, following Prisma's official upgrade guide to v7.

Where Prisma 6, 7 and 8 stand#

ORM 7 is the stable line to upgrade to. ORM 8 is still a release candidate, and ORM 6 is in its last days of security-only support.

VersionStatus on Prisma's release-status page
ORM 6Security patches only, no other updates. Ends 19 November 2026.
ORM 7Stable. Bug fixes and security updates for 18 months from the day ORM 8 reaches general availability. Latest: @prisma/client 7.10.1.
ORM 8Release candidate. The page lists prisma 8.0.0-rc.34 and @prisma/orm-postgres 8.0.0-rc.24 as of 16 November 2026, gives no GA date, and says the changelog will announce the final release.

Three cards comparing Prisma ORM 6, 7 and 8 support: ORM 6 security patches only until 19 Nov 2026, ORM 7 bug fixes and security for 18 months after ORM 8 GA, ORM 8 release candidate

ORM 7 shipped as v7.0.0 on 19 November 2025, which is where the 12-month window for ORM 6 comes from.

One trap before you start: the npm latest tag for prisma points at the ORM 8 release candidate, and ORM 7 sits under prisma@prev. Always install with an explicit @7, never a bare npm install prisma. If ORM 8 is where you are heading, my Prisma 8 guide covers that path; on PostgreSQL, Prisma's docs say a v6 app can go straight to 8 without stopping at 7.

MongoDB users: Prisma ORM 7 does not support MongoDB. The official guide says to stay on v6 for now, and Prisma publishes a separate v6 to 8 MongoDB guide.

What changes from Prisma 6 to 7?#

AreaPrisma 6Prisma 7
Module formatCommonJS or ESMESM only ("type": "module")
Generatorprisma-client-jsprisma-client, output required
Client import@prisma/clientYour output path, e.g. ./generated/prisma/client
Database URLurl in schema.prismadatasource.url in prisma.config.ts
Client constructordatasources / datasourceUrladapter (driver adapter, every database)
.env loadingAutomaticNot loaded; use dotenv
Middlewareprisma.$useRemoved; use Client Extensions
Metrics$metrics (deprecated in 6.14)Removed
migrate devRuns generate and seedRuns neither
SSLInvalid certificates ignoredValidated by node-pg
Minimum Node.js / TypeScript18.18 / 5.120.19.0 / 5.4.0

Step 1: Check Node.js and TypeScript#

Prisma ORM 7 needs at least Node.js 20.19.0 and TypeScript 5.4.0. The guide recommends Node.js 22 and TypeScript 5.9. If you plan to move to ORM 8 later, its requirements are higher (Node.js 22.18+, 24.11+ or 26+ and TypeScript 5.9+), so landing on Node 22 or 24 now saves a second runtime upgrade. My Node 24 vs Node 26 comparison helps pick one.

Four-step checklist for moving off Prisma 6: check Node runtime, check TypeScript version, upgrade prisma and client, then test migrations and tests

bash
node --version   # v20.19.0 or newer
npx tsc --version  # 5.4.0 or newer

Step 2: Install Prisma 7 packages#

Upgrade the CLI and the client together, plus the driver adapter for your database and dotenv:

npm install @prisma/client@7 dotenv
npm install -D prisma@7

# PostgreSQL
npm install @prisma/adapter-pg@7
# or SQLite
npm install @prisma/adapter-better-sqlite3@7
pnpm add @prisma/client@7 dotenv
pnpm add -D prisma@7

# PostgreSQL
pnpm add @prisma/adapter-pg@7
# or SQLite
pnpm add @prisma/adapter-better-sqlite3@7
yarn add @prisma/client@7 dotenv
yarn add -D prisma@7

# PostgreSQL
yarn add @prisma/adapter-pg@7
# or SQLite
yarn add @prisma/adapter-better-sqlite3@7
bun add @prisma/client@7 dotenv
bun add -d prisma@7

# PostgreSQL
bun add @prisma/adapter-pg@7
# or SQLite
bun add @prisma/adapter-better-sqlite3@7

On pnpm 10 or later, approve the better-sqlite3 build script, or the SQLite adapter has no native binding.

Step 3: Switch the project to ESM#

Prisma ORM 7 ships as an ES module. Set the module type in package.json:

json
{
  "type": "module"
}

And make TypeScript resolve modules the way the generated client expects:

json
{
  "compilerOptions": {
    "module": "ESNext",
    "moduleResolution": "bundler",
    "target": "ES2023",
    "strict": true,
    "esModuleInterop": true
  }
}

This is usually the biggest change in an older Node project. Any require() calls and __dirname uses in your own code need converting too.

Step 4: Update the generator block#

Replace prisma-client-js with prisma-client and give it an output path. The client is no longer generated into node_modules.

prisma
// Before (Prisma 6)
generator client {
  provider = "prisma-client-js"
}

// After (Prisma 7)
generator client {
  provider = "prisma-client"
  output   = "../src/generated/prisma"
}

Only output is required. runtime, moduleFormat, generatedFileExtension and importFileExtension are optional and inferred from your environment and tsconfig.json. If you run with tsx and see Cannot find module './internal/class.js', Prisma's generator docs suggest adding importFileExtension = "ts".

Remove url, directUrl and shadowDatabaseUrl from the datasource block; they move to the config file in the next step. Add the output folder to .gitignore if you regenerate in CI.

Step 5: Create prisma.config.ts#

prisma.config.ts is now where the CLI reads the database URL, schema path, migrations folder and seed command. Put it at the project root, next to package.json:

ts
import "dotenv/config";
import { defineConfig, env } from "prisma/config";

export default defineConfig({
  schema: "prisma/schema.prisma",
  migrations: {
    path: "prisma/migrations",
    seed: "tsx prisma/seed.ts",
  },
  datasource: {
    url: env("DATABASE_URL"),
    // shadowDatabaseUrl: env("SHADOW_DATABASE_URL"),
  },
});

If you used directUrl for migrations behind a pooler, pass that direct connection string as url here. The CLI uses url for migrations; your app's pooled URL goes to the adapter in the next step.

The import "dotenv/config" line matters: Prisma 7 no longer loads .env files on its own. Bun loads them automatically, so Bun projects can skip it.

Step 6: Create the client with a driver adapter#

Every database now needs a driver adapter, and the datasources / datasourceUrl constructor options are gone.

ts
// Before (Prisma 6)
import { PrismaClient } from "@prisma/client";
export const prisma = new PrismaClient({
  datasourceUrl: process.env.DATABASE_URL,
});
ts
// After (Prisma 7, PostgreSQL)
import { PrismaClient } from "./generated/prisma/client";
import { PrismaPg } from "@prisma/adapter-pg";

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

export const prisma = new PrismaClient({ adapter });
ts
// After (Prisma 7, SQLite)
import { PrismaClient } from "./generated/prisma/client";
import { PrismaBetterSqlite3 } from "@prisma/adapter-better-sqlite3";

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

export const prisma = new PrismaClient({ adapter });

Then find and replace every from "@prisma/client" import. Generated types such as Prisma, model types and enums now come from your output path as well:

bash
grep -rn "@prisma/client" src/

Step 7: Generate, migrate and seed explicitly#

prisma migrate dev and prisma db push no longer run prisma generate, and migrate dev / migrate reset no longer run your seed. Chain them yourself:

bash
npx prisma generate
npx prisma migrate dev
npx prisma db seed

Update package.json scripts, CI jobs and Dockerfiles the same way. A build that used to rely on migrate deploy or postinstall to generate the client needs an explicit prisma generate step.

Breaking changes and how to fix each#

Middleware (prisma.$use) is removed#

Rewrite middleware as a query extension:

ts
// Prisma 6
prisma.$use(async (params, next) => {
  return next(params);
});

// Prisma 7
const prisma = new PrismaClient({ adapter }).$extends({
  query: {
    user: {
      async findMany({ args, query }) {
        return query(args);
      },
    },
  },
});

Use $allModels and $allOperations inside query for middleware that ran on every call, such as logging or soft-delete filters.

Metrics are removed#

$metrics was deprecated in 6.14.0 and removed in 7.0.0. Count queries in a Client Extension, or read pool statistics from the driver (pg.Pool exposes totalCount, idleCount and waitingCount).

Connection timeouts behave differently#

The adapter uses the Node.js driver's pool settings, not Prisma 6's. For example, pg has no connection timeout by default, where Prisma 6 used 5 seconds. If requests hang or time out differently after the upgrade, set the pool options on the adapter to match what you had.

SSL errors: P1010 after upgrading#

Prisma 7 connects through node-pg, which validates certificates. Prisma 6's Rust engine ignored invalid ones, so a database with a self-signed certificate can start failing with:

text
Error: P1010: User was denied access on the database <database>

The right fix is to trust the certificate with NODE_EXTRA_CA_CERTS or node --use-openssl-ca. To restore the old behaviour while you sort that out:

ts
const adapter = new PrismaPg({
  connectionString: process.env.DATABASE_URL,
  ssl: { rejectUnauthorized: false },
});

Removed CLI flags#

Prisma 6Prisma 7
migrate dev --skip-generate / --skip-seedRemoved; neither runs by default
db push --skip-generateRemoved
db execute --schema / --urlRemoved; set the connection in prisma.config.ts
migrate diff --from-url / --to-url--from-config-datasource / --to-config-datasource
migrate diff --from-schema-datasource--from-config-datasource
migrate diff --shadow-database-urlshadowDatabaseUrl in prisma.config.ts

Removed environment variables#

Engine-related variables no longer do anything: PRISMA_CLI_QUERY_ENGINE_TYPE, PRISMA_CLIENT_ENGINE_TYPE, PRISMA_QUERY_ENGINE_BINARY, PRISMA_QUERY_ENGINE_LIBRARY, PRISMA_GENERATE_SKIP_AUTOINSTALL, PRISMA_SKIP_POSTINSTALL_GENERATE, PRISMA_GENERATE_IN_POSTINSTALL, PRISMA_GENERATE_DATAPROXY, PRISMA_GENERATE_NO_ENGINE, PRISMA_CLIENT_NO_RETRY, PRISMA_MIGRATE_SKIP_GENERATE and PRISMA_MIGRATE_SKIP_SEED. Remove them from Dockerfiles and CI so nobody assumes they still apply.

Mapped enums#

An early v7 change made generated enums use @map values; Prisma reverted it. Generated enums use the schema names, as in v6, so SuggestionStatus.PENDING is still "PENDING". No change is needed.

Prisma Accelerate#

Standalone Accelerate and prisma+postgres://accelerate.prisma-data.net connections retire on 1 December 2026. Do not pass an Accelerate URL to PrismaPg; it expects a direct connection string. If you must upgrade before leaving Accelerate, create the client with accelerateUrl and withAccelerate() and no adapter, then follow Prisma's switch-over guide for your database before December.

How do I verify the upgrade?#

Apply the schema to a throwaway database and run your test suite against it. For PostgreSQL, the official guide uses create-db, which creates a temporary Prisma Postgres database without an account:

bash
TEST_DATABASE_URL="$(npx -y create-db@latest --quiet)" &&
npx prisma db push --url "${TEST_DATABASE_URL:?}" &&
DATABASE_URL="$TEST_DATABASE_URL" npm test

--url needs Prisma 7.2.0 or later, and db push builds tables from the schema without running prisma/migrations. Before production, also run prisma migrate deploy against a staging copy of the real database so the migration history is exercised, not just the schema.

Prisma 6 to 7 upgrade checklist#

  1. Confirm Node.js 20.19+ (22 recommended) and TypeScript 5.4+.
  2. Install prisma@7, @prisma/client@7, the driver adapter and dotenv. Never install a bare prisma.
  3. Set "type": "module" and update tsconfig.json.
  4. Change the generator to prisma-client with an output path.
  5. Move url, directUrl and shadowDatabaseUrl into prisma.config.ts, with import "dotenv/config".
  6. Create PrismaClient with a driver adapter and replace every @prisma/client import.
  7. Replace $use middleware with $extends and remove $metrics.
  8. Add explicit prisma generate and prisma db seed steps to scripts, CI and Dockerfiles.
  9. Replace removed CLI flags and environment variables.
  10. Check SSL and pool timeouts against your production database.
  11. Run tests on a throwaway database, then migrate deploy on staging, then production.
  12. Leave Accelerate before 1 December 2026 if you use it.

Does anything stop working on 19 November?#

No. Installed ORM 6 versions keep running. What ends is maintenance: a vulnerability found after 19 November will not get a fix in the 6 line. For an API that handles user data, that is reason enough to upgrade now rather than after the next advisory. My secure NestJS and Prisma API starter shows the kind of setup that benefits from staying on supported releases, and Drizzle vs Prisma covers the alternative if you are reconsidering the ORM altogether.

Sources: Prisma upgrade guide to v7, Prisma release status, Prisma generators reference and the Prisma changelog.

Questions

Comments

Add to the discussion…

No comments yet. Questions, corrections and your own results are all welcome.

Be kind and stay on topic. No name needed: leave it blank and you post under an anonymous name that stays yours. Links get nofollow; spam is removed. Your email is never shown and is only used for reply notifications you ask for. Privacy