# Prisma ORM 6 or 7 to 8 (PostgreSQL) (/docs/guides/upgrade-prisma-orm/postgresql) > For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL. Use when a PostgreSQL app on Prisma ORM 6 or 7 should move to Prisma 8 in one pass, keeping its schema.prisma, its database and its data Location: Guides > Upgrade Prisma ORM > Prisma ORM 6 or 7 to 8 (PostgreSQL) > [!NOTE] > Not for a route-by-route upgrade, MongoDB, or deploying > > To keep Prisma ORM 7 running beside Prisma 8 and move one route at a time, follow [Prisma ORM 7 to 8, route by route](https://www.prisma.io/docs/guides/upgrade-prisma-orm/postgresql-incremental). For MongoDB, follow [Prisma ORM 6 to 8 (MongoDB)](https://www.prisma.io/docs/guides/upgrade-prisma-orm/mongodb). To host the upgraded app, continue with [Deploy an existing app on Prisma Compute](https://www.prisma.io/docs/guides/compute/deploy-existing-app) when you finish this guide. This guide moves an Express, Fastify, Hono or other Node.js server from Prisma ORM 6 or 7 on PostgreSQL to Prisma 8 in one pass. You keep your `schema.prisma`, your database and its data. At the end, Prisma 8 owns your migrations, every query runs through the Prisma 8 client, and the app runs wherever it ran before, reading `DATABASE_URL` as it does today. A Prisma ORM 6 app does not need to upgrade to Prisma ORM 7 first, because Prisma 8 reads a Prisma ORM 6 schema as it is. The examples follow a small feedback board: Express 4, EJS views, Prisma ORM 6.19, compiled with `tsc` and run with `node`. Its models are `Board`, `Post`, `Vote` and `Comment`, with a `PostStatus` enum. Map the names to your own app. ## Two ways to upgrade [#two-ways-to-upgrade] Follow the steps below yourself, or have your coding agent follow them with the `prisma-postgres-upgrade` [skill](https://www.prisma.io/docs/ai/tools/skills): #### npm ```bash npx skills add prisma/skills --skill prisma-postgres-upgrade ``` #### pnpm ```bash pnpm dlx skills add prisma/skills --skill prisma-postgres-upgrade ``` #### yarn ```bash yarn dlx skills add prisma/skills --skill prisma-postgres-upgrade ``` #### bun ```bash bunx skills add prisma/skills --skill prisma-postgres-upgrade ``` Then ask your agent from the project root: ```text Upgrade this app from Prisma ORM 6 to Prisma 8. ``` The agent runs your project's type check, build and tests before and after the upgrade, and leaves the change for you to review. To deploy the upgraded app afterwards, add the `prisma-compute` skill, which follows [Deploy an existing app on Prisma Compute](https://www.prisma.io/docs/guides/compute/deploy-existing-app): #### npm ```bash npx skills add prisma/skills --skill prisma-compute ``` #### pnpm ```bash pnpm dlx skills add prisma/skills --skill prisma-compute ``` #### yarn ```bash yarn dlx skills add prisma/skills --skill prisma-compute ``` #### bun ```bash bunx skills add prisma/skills --skill prisma-compute ``` ## Prerequisites [#prerequisites] - **Node.js 22.18 or newer on the 22 line, 24.11 or newer on the 24 line, or 26 or newer**; Node.js 24 recommended. See [Supported versions](https://www.prisma.io/docs/orm/supported-versions). - **A working Prisma ORM 6 or 7 app on PostgreSQL**, and a database it has migrated. Start the app and load a page that queries the database before you change anything, so you have something to compare with. - **TypeScript 5.9 or newer**, with `"strict": true`. ## 1. Install Prisma 8 [#1-install-prisma-8] ### 1.1. Replace the Prisma CLI [#11-replace-the-prisma-cli] Remove the Prisma ORM 6 or 7 CLI and install the Prisma 8 CLI and its PostgreSQL runtime: #### npm ```bash npm uninstall prisma npm install --save-dev --save-exact prisma@8.0.0-rc.27 npm install --save-exact @prisma/orm-postgres@8.0.0-rc.20 npm install dotenv ``` #### pnpm ```bash pnpm remove prisma pnpm add --save-dev --save-exact prisma@8.0.0-rc.27 pnpm add --save-exact @prisma/orm-postgres@8.0.0-rc.20 pnpm add dotenv ``` #### yarn ```bash yarn remove prisma yarn add --dev --exact prisma@8.0.0-rc.27 yarn add --exact @prisma/orm-postgres@8.0.0-rc.20 yarn add dotenv ``` #### bun ```bash bun remove prisma bun add --dev --exact prisma@8.0.0-rc.27 bun add --exact @prisma/orm-postgres@8.0.0-rc.20 bun add dotenv ``` `prisma` is the Prisma 8 CLI, and `@prisma/orm-postgres` is the PostgreSQL runtime your code imports. The two packages have separate version numbers. `dotenv` loads your `.env` file in `prisma.config.ts` and `src/db.ts`, because the Prisma 8 CLI does not load it the way Prisma ORM 6 did. Install it even if `node_modules` already has a copy that another package brought in. Install these exact versions, not `@latest`. They are the versions Prisma Compute deploys today, so the app stays ready for [Deploy an existing app on Prisma Compute](https://www.prisma.io/docs/guides/compute/deploy-existing-app): the Console's setup keeps the `prisma` and `@prisma/orm-postgres` versions your `package.json` declares, and the latest pair on npm does not work with the Composer version it installs. The rest of this guide, including the query notes in step 5, was tested at these versions. Leave `@prisma/client`, a driver adapter such as `@prisma/adapter-pg`, and the generated client in place for now. Step 6 removes them. > [!NOTE] > Your old client after a fresh install > > From here on, `prisma` is the Prisma 8 CLI and nothing regenerates your old client, so this guide rewrites every query in one pass. To move a Prisma ORM 7 app gradually instead, keep its CLI as `prisma7` with `@prisma/prisma7` and follow the [route-by-route guide](https://www.prisma.io/docs/guides/upgrade-prisma-orm/postgresql-incremental). Prisma ORM 6 has no equivalent. > > The client you already generated keeps working on your machine while you rewrite queries in step 5. A fresh install, such as a CI run or a new clone, has none, and a Prisma ORM 6 app then fails with `@prisma/client did not initialize yet`. Rewrite every query before you push this work to a branch that CI builds. ### 1.2. Remove `prisma generate` from your scripts [#12-remove-prisma-generate-from-your-scripts] The Prisma 8 CLI has no `generate` command. `npx prisma generate` now fails with `CLI.UNKNOWN_COMMAND` and exit code `2`, so any script that runs it, such as `build` or `postinstall`, fails too. Remove it, along with the Prisma ORM 6 or 7 migration and seed scripts. Step 3 sets up the Prisma 8 migration command: ```json title="package.json (excerpt)" { "scripts": { "build": "prisma generate && tsc", // [!code --] "build": "tsc", // [!code ++] "postinstall": "prisma generate", // [!code --] "db:migrate": "prisma migrate dev", // [!code --] "db:deploy": "prisma migrate deploy", // [!code --] "db:seed": "prisma db seed", // [!code --] "db:migrate": "prisma db migrate" // [!code ++] }, "prisma": { "seed": "tsx prisma/seed.ts" } // [!code --] } ``` Prisma 8 has no seed command. To seed, write a script that imports the client from step 5 and calls `.create(...)`, and run it with `tsx`. **Check:** `npx prisma --version` prints `8.0.0-rc.27`. ## 2. Create the contract from your schema [#2-create-the-contract-from-your-schema] Prisma 8 describes your models as a [contract](https://www.prisma.io/docs/orm/contract-authoring/the-data-contract). It can read your existing `schema.prisma` as that contract, so you keep editing the file you have. ### 2.1. Write `prisma.config.ts` [#21-write-prismaconfigts] Create `prisma.config.ts` in the project root. In a Prisma ORM 7 app, replace the `prisma.config.ts` you have, because Prisma 8 reads only its own config format under that name: ```typescript title="prisma.config.ts" import "dotenv/config"; import { definePrismaConfig } from "prisma/config"; import { defineConfig, prisma7Schema } from "@prisma/orm-postgres/config"; export default definePrismaConfig({ orm: defineConfig({ contract: prisma7Schema("prisma/schema.prisma"), output: "src/prisma", db: { connection: process.env["DATABASE_URL"], }, }), }); ``` `prisma7Schema(...)` reads a Prisma ORM 7 schema, and it reads a Prisma ORM 6 schema unchanged too: the `generator client { provider = "prisma-client-js" }` block and `url = env("DATABASE_URL")` in the datasource stay as they are, and Prisma 8 ignores them. `output: "src/prisma"` writes the emitted contract inside `src/`, where `tsc` compiles it. [Use a Prisma ORM 7 schema](https://www.prisma.io/docs/cli/configuration#use-a-prisma-orm-7-schema) lists how each date and time type reads, and the parts of a schema Prisma 8 cannot read, such as `view` blocks. A field marked `@ignore` and a model marked `@@ignore` stay out of the Prisma 8 client, as they stayed out of your old client: queries neither return nor write an ignored field, and an ignored model has no `db.orm.public.`. [Raw SQL](https://www.prisma.io/docs/orm/reference/raw-queries) still reaches them. Their columns and tables stay in the database, and you do nothing for them: adding or removing `@ignore` later does not change the database. If the `datasource` block lists PostgreSQL extensions, as in `extensions = [citext, pg_trgm]`, or a field uses `@db.Citext`, two limits of the versions installed in step 1.1 apply: - Prisma 8 does not read the `extensions` list. Your existing database keeps its extensions, but the baseline in step 3 does not create them, so in a new, empty database run `CREATE EXTENSION` for each one, such as `CREATE EXTENSION IF NOT EXISTS pg_trgm;`, before `npx prisma db migrate`. - Prisma 8 cannot read a `@db.Citext` field: `contract emit` stops with `PSL.PRISMA7_NATIVE_TYPE_UNSUPPORTED`. Later releases read the `extensions` list and `@db.Citext` fields, as [Use a Prisma ORM 7 schema](https://www.prisma.io/docs/cli/configuration#use-a-prisma-orm-7-schema) shows, but Prisma Compute does not deploy them yet. So an app with a `@db.Citext` field cannot both upgrade and deploy on Compute today. If you do not deploy on Compute, install `prisma@latest` and `@prisma/orm-postgres@latest` in step 1.1 instead of the pinned versions. Then add an extension pack, an npm package that adds an extension's column types, for each of `citext`, `vector`, `postgis` and `pg_search` in your list. A `@db.Citext` field needs the citext pack even when your list does not name `citext` or there is no list. Add the packs to the config as in [step 2.3 of the route-by-route guide](https://www.prisma.io/docs/guides/upgrade-prisma-orm/postgresql-incremental#23-add-the-packs-for-postgresql-extensions), and pass them to the client you create in step 5.1, as the route-by-route guide's [step 3.1](https://www.prisma.io/docs/guides/upgrade-prisma-orm/postgresql-incremental#31-instantiate-both-clients) shows. If you use a coding agent, install the [agent skills](https://www.prisma.io/docs/cli/skills) that ship inside the Prisma 8 packages, matched to their versions: #### npm ```bash npx prisma skills sync ``` #### pnpm ```bash pnpm prisma skills sync ``` #### yarn ```bash yarn prisma skills sync ``` #### bun ```bash bunx prisma skills sync ``` It needs the Prisma 8 `prisma.config.ts`: with a Prisma ORM 7 config still in place, it fails with `CLI.CONFIG_UNREADABLE`. If you later deploy on Prisma Compute, run it again after you add Composer, which ships a skill of its own. ### 2.2. Emit the contract [#22-emit-the-contract] #### npm ```bash npx prisma contract emit ``` #### pnpm ```bash pnpm prisma contract emit ``` #### yarn ```bash yarn prisma contract emit ``` #### bun ```bash bunx prisma contract emit ``` **Expected result:** `Emitted contract.json and contract.d.ts`, and the two files in `src/prisma/`. `contract.json` is what the Prisma 8 client reads at runtime, and `contract.d.ts` holds its types. Commit both, and run `contract emit` again after every change to `schema.prisma`. If `contract emit` fails, its error names the line in `schema.prisma` and the edit to make. ### 2.3. Sign the existing database [#23-sign-the-existing-database] Your database already has every table the contract describes. Record that in the database: #### npm ```bash npx prisma db sign ``` #### pnpm ```bash pnpm prisma db sign ``` #### yarn ```bash yarn prisma db sign ``` #### bun ```bash bunx prisma db sign ``` [`db sign`](https://www.prisma.io/docs/cli/db-sign) checks that the tables match the contract, then writes a marker in the database that names the contract it matches. It does not change your tables. It also writes a snapshot of the contract under `migrations/snapshots/` and a ref named `db` in `migrations/app/refs/db.json`, which step 3 plans from. **Expected result:** the command prints `Database signed` and `Advanced ref "db"`. If you keep using other existing databases, such as a staging database, run `db sign` once against each of them with `DATABASE_URL` pointing at it. A new, empty database does not need it, because `db migrate` in step 3 creates its tables. ## 3. Hand migrations to Prisma 8 [#3-hand-migrations-to-prisma-8] From here on, Prisma 8 plans and applies schema changes, and you stop running `prisma migrate`. Prisma 8 keeps reading `prisma/schema.prisma`, so you go on editing the same file. ### 3.1. Plan the baseline migration [#31-plan-the-baseline-migration] #### npm ```bash npx prisma migration plan --name init ``` #### pnpm ```bash pnpm prisma migration plan --name init ``` #### yarn ```bash yarn prisma migration plan --name init ``` #### bun ```bash bunx prisma migration plan --name init ``` **Expected result:** `Planned baseline (12 operation(s)) + 0 operation(s)`, with your own number of operations, and a folder `migrations/app/_baseline`. On a signed database, the first `migration plan` always names that folder `baseline` and ignores `--name`. The baseline creates every table, index and foreign key in the contract, so a new, empty database ends up with your schema. Your existing database skips it, because its marker already names that contract: #### npm ```bash npx prisma db migrate ``` #### pnpm ```bash pnpm prisma db migrate ``` #### yarn ```bash yarn prisma db migrate ``` #### bun ```bash bunx prisma db migrate ``` **Expected result:** the command prints `(no operations)`. Against a new, empty database, such as one for CI or a new environment, the same command applies the baseline. Commit the `migrations/` folder, which holds the baseline, the snapshot and the `db` ref, together with `src/prisma/contract.json` and `src/prisma/contract.d.ts`. ### 3.2. Retire `prisma/migrations` [#32-retire-prismamigrations] Prisma 8 does not read the `prisma/migrations` folder, and the baseline already describes the schema those migrations built. Delete the folder, including `migration_lock.toml`: ```bash rm -r prisma/migrations ``` Keep `prisma/schema.prisma`: it is still your contract. Prisma ORM 6 and 7 recorded applied migrations in a `_prisma_migrations` table, which stays in the database. Prisma 8 leaves it out of `db verify` and `contract infer`, and you can drop it whenever you like. From now on, a schema change is: edit `prisma/schema.prisma`, then run #### npm ```bash npx prisma contract emit npx prisma migration plan --name npx prisma db migrate ``` #### pnpm ```bash pnpm prisma contract emit pnpm prisma migration plan --name pnpm prisma db migrate ``` #### yarn ```bash yarn prisma contract emit yarn prisma migration plan --name yarn prisma db migrate ``` #### bun ```bash bunx prisma contract emit bunx prisma migration plan --name bunx prisma db migrate ``` `db migrate` points `migrations/app/refs/db.json` at the new contract, so the next `migration plan` starts from it. [How migrations work](https://www.prisma.io/docs/orm/migrations/how-migrations-work) covers the full loop. ## 4. Point TypeScript at the Prisma 8 client [#4-point-typescript-at-the-prisma-8-client] Every Prisma 8 package is published as ES modules, and your code imports the emitted `contract.json`. An app that compiles with `tsc` and runs the output with `node` can stay CommonJS. Set `module` and `moduleResolution` to `nodenext`, and turn on `resolveJsonModule`: ```json title="tsconfig.json (excerpt)" { "compilerOptions": { "module": "commonjs", // [!code --] "module": "nodenext", // [!code ++] "moduleResolution": "nodenext", // [!code ++] "resolveJsonModule": true, // [!code ++] "outDir": "dist", "rootDir": "src", "strict": true }, "include": ["src"] } ``` Keep `package.json` without `"type": "module"`, and your relative imports stay as they are, without extensions. Keep `include` limited to `src` as well, so `tsc` does not compile `prisma.config.ts` into `dist/`. If your app runs through `tsx` or a bundler, or `package.json` has `"type": "module"`, [Set up tsconfig.json](https://www.prisma.io/docs/guides/upgrade-prisma-orm/postgresql-incremental#25-set-up-tsconfigjson-for-the-prisma-orm-8-client) gives the settings for each case. ## 5. Rewrite your queries [#5-rewrite-your-queries] ### 5.1. Create the Prisma 8 client [#51-create-the-prisma-8-client] Replace the file that creates `PrismaClient`. The Prisma 8 client reads `DATABASE_URL`, as your Prisma ORM 6 or 7 client did. #### Prisma 8 ```typescript title="src/db.ts" import "dotenv/config"; import postgres from "@prisma/orm-postgres/runtime"; import { contractFromJson } from "@prisma/orm-postgres/static"; import type { Contract } from "./prisma/contract.d"; import contractJson from "./prisma/contract.json"; export const db = postgres({ contract: contractFromJson(contractJson), url: process.env["DATABASE_URL"]!, }); ``` #### Prisma ORM 6 ```typescript title="src/db.ts" import { PrismaClient } from "@prisma/client"; export const prisma = new PrismaClient(); ``` #### Prisma ORM 7 ```typescript title="src/db.ts" import { PrismaPg } from "@prisma/adapter-pg"; import { PrismaClient } from "../generated/prisma/client"; const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL! }); export const prisma = new PrismaClient({ adapter }); ``` In a file that compiles as an ES module, write the JSON import as `import contractJson from "./prisma/contract.json" with { type: "json" };`. ### 5.2. Rewrite each query [#52-rewrite-each-query] A Prisma 8 query starts from `db.orm.public.`, where `public` is the PostgreSQL schema your tables are in, and chains calls instead of taking one options object. The last call, such as `.all()`, `.first()` or `.create(...)`, says what you get back. The calls in Prisma ORM 6 and 7 are the same, so one rewrite covers both: #### Prisma 8 ```typescript title="src/server.ts (excerpt)" import { db } from "./db"; // findMany with a relation count and orderBy const boards = await db.orm.public.Board.include("posts", (posts) => posts.count()) .orderBy((b) => b.createdAt.asc()) .all(); // boards[0].posts is a number // findMany with where, two counts, and ordering by a relation count const posts = await db.orm.public.Post.where({ boardId: board.id }) .include("votes", (votes) => votes.count()) .include("comments", (comments) => comments.count()) .orderBy([(p) => p.votes.count().desc(), (p) => p.createdAt.desc()]) .all(); // findUnique by primary key, with relations const post = await db.orm.public.Post.whereUnique({ id }) .include("board") .include("comments", (comments) => comments.orderBy((c) => c.createdAt.asc())) .include("votes", (votes) => votes.count()) .first(); // findUnique by a @unique field, and by a compound @@unique const bySlug = await db.orm.public.Board.where({ slug }).first(); const vote = await db.orm.public.Vote.where({ postId, voterId }).first(); // create with a nested create const created = await db.orm.public.Post.create({ boardId: board.id, title, body, author, votes: (v) => v.create([{ voterId }]), }); // deleteMany, returning the number of deleted rows const deleted = await db.orm.public.Vote.where({ postId, voterId }).deleteAndCount(); // cursor pagination: the page starts after the cursor row const nextPage = await db.orm.public.Post.where({ boardId: board.id }) .orderBy((p) => p.id.asc()) .cursor({ id: lastId }) .limit(20) .all(); // count const { total } = await db.orm.public.Post.where({ boardId: board.id }).aggregate((agg) => ({ total: agg.count(), })); // $queryRaw await db.query(db.raw.sql`SELECT 1 AS ok`.returnsRow({ ok: "pg/int4@1" }).build()); // enum values const STATUSES = db.nativeEnums.public.PostStatus.values; ``` #### Prisma ORM 6 and 7 ```typescript title="src/server.ts (excerpt)" import { PostStatus } from "@prisma/client"; import { prisma } from "./db"; const boards = await prisma.board.findMany({ orderBy: { createdAt: "asc" }, include: { _count: { select: { posts: true } } }, }); // boards[0]._count.posts is a number const posts = await prisma.post.findMany({ where: { boardId: board.id }, include: { _count: { select: { votes: true, comments: true } } }, orderBy: [{ votes: { _count: "desc" } }, { createdAt: "desc" }], }); const post = await prisma.post.findUnique({ where: { id }, include: { board: true, comments: { orderBy: { createdAt: "asc" } }, _count: { select: { votes: true } }, }, }); const bySlug = await prisma.board.findUnique({ where: { slug } }); const vote = await prisma.vote.findUnique({ where: { postId_voterId: { postId, voterId } }, }); const created = await prisma.post.create({ data: { boardId: board.id, title, body, author, votes: { create: { voterId } } }, }); const deleted = (await prisma.vote.deleteMany({ where: { postId, voterId } })).count; const nextPage = await prisma.post.findMany({ where: { boardId: board.id }, orderBy: { id: "asc" }, cursor: { id: lastId }, skip: 1, take: 20, }); const total = await prisma.post.count({ where: { boardId: board.id } }); await prisma.$queryRaw`SELECT 1`; const STATUSES = Object.values(PostStatus); ``` Six differences catch most rewrites: - **A count lands on the relation's own key.** `include("votes", (votes) => votes.count())` puts the number in `post.votes`, where Prisma ORM 6 and 7 put it in `post._count.votes`. Update the views and response code that read `_count`. `tsc` does not check templates such as EJS views, so they still compile while they read `_count.*`. - **`whereUnique` takes only the primary key here.** A schema read through `prisma7Schema(...)` keeps each `@unique` and `@@unique` as the unique index Prisma ORM 6 and 7 created, and `whereUnique` accepts only a primary key or a unique constraint. Look rows up by those fields with `.where({ ... }).first()`, which runs the same query. - **The cursor row is left out.** In Prisma ORM 6 and 7, a page that starts at `cursor` includes the cursor row itself unless you add `skip: 1`. `.cursor(...)` starts after the cursor row, so drop `skip: 1`. If a query had no `skip: 1`, its pages now start one row later. - **Enums come from the client.** An `enum` in a Prisma ORM 6 or 7 schema is a PostgreSQL enum type, so its values are in `db.nativeEnums.public..values`. Fields of that type still read and write the same strings. - **At `@prisma/orm-postgres@8.0.0-rc.20`, a `DateTime` field reads as a string**, such as `"2026-11-06 09:10:48.497"`: the stored UTC time, without an offset. Code that calls a `Date` method on it, such as `post.createdAt.toISOString()` in a template, fails. Use the string, or convert it with `new Date(value.replace(" ", "T") + "Z")`. Templates that `tsc` does not check still compile while they call it. Later releases read the field as a `Date` again, so check this when you upgrade. - **At the same version, `@default(now())` is filled by the database.** A `@default(now())` field you leave out of `.create(...)` gets its value from the database's `now()`, which for a `timestamp` column is the database's local time. Prisma ORM 6 and 7 sent the UTC time instead. Run `SHOW timezone` on your database: if it prints anything other than `UTC`, new rows store local time where old rows store UTC. Decide how to handle it before you ship, for example by setting the database's time zone with `ALTER DATABASE SET timezone TO 'UTC'`, or by passing the field yourself in `.create(...)`. The [ORM client reference](https://www.prisma.io/docs/orm/reference/orm-client) has every method, and [Coming from Prisma ORM 7](https://www.prisma.io/docs/orm/coming-from-prisma-orm-7#queries) maps the rest of the Prisma ORM 6 and 7 query API, including what has no Prisma 8 form yet, such as `increment` in an update. ### 5.3. Run the app locally [#53-run-the-app-locally] #### npm ```bash npm run build npm start ``` #### pnpm ```bash pnpm run build pnpm start ``` #### yarn ```bash yarn build yarn start ``` #### bun ```bash bun run build bun start ``` Load the same pages as before you started, and try each write. **Expected result:** the pages show the same data as on Prisma ORM 6 or 7, and `npx tsc --noEmit` passes with no file importing `@prisma/client` or the generated client. Then search the code `tsc` does not check, such as views, for the two Prisma ORM 6 and 7 habits that fail only at runtime: ```bash grep -rn "_count\|toISOString" views src ``` Each match is a place that still reads `_count` or calls a `Date` method on a field that is now a string. ## 6. Remove Prisma ORM 6 or 7 [#6-remove-prisma-orm-6-or-7] When no file imports `@prisma/client` or the generated client, remove them and the driver adapter: #### npm ```bash npm uninstall @prisma/client @prisma/adapter-pg ``` #### pnpm ```bash pnpm remove @prisma/client @prisma/adapter-pg ``` #### yarn ```bash yarn remove @prisma/client @prisma/adapter-pg ``` #### bun ```bash bun remove @prisma/client @prisma/adapter-pg ``` Then delete the generated Prisma ORM 7 client folder, such as `generated/prisma`, and any seed script that still imports `@prisma/client`. `npm uninstall` leaves a generated Prisma ORM 6 client behind in `node_modules/.prisma`, where code can still import it without an error until the next clean install. Delete it too: ```bash rm -rf node_modules/.prisma ``` **Check:** `npm run build` passes, and `npx prisma db verify` reports that the database matches the contract. ## Next steps [#next-steps] - [How migrations work](https://www.prisma.io/docs/orm/migrations/how-migrations-work): the day-to-day `contract emit`, `migration plan` and `db migrate` loop. - [ORM client reference](https://www.prisma.io/docs/orm/reference/orm-client): every Prisma 8 query method. - [Deploy an existing app on Prisma Compute](https://www.prisma.io/docs/guides/compute/deploy-existing-app): host the upgraded app, with a Prisma Postgres database for each branch. ## Related pages - [Prisma ORM 6 to 8 (MongoDB)](https://www.prisma.io/docs/guides/upgrade-prisma-orm/mongodb): Migrate a MongoDB project from Prisma ORM 6 to Prisma ORM 8 - [Prisma ORM 7 to 8, route by route (PostgreSQL)](https://www.prisma.io/docs/guides/upgrade-prisma-orm/postgresql-incremental): Use when a PostgreSQL app on Prisma ORM 7 should move to Prisma 8 gradually, with both versions running side by side and one route moving at a time - [Upgrade to v1](https://www.prisma.io/docs/guides/upgrade-prisma-orm/v1): Guide for upgrading from Prisma 1 to Prisma ORM - [Upgrade to v3](https://www.prisma.io/docs/guides/upgrade-prisma-orm/v3): Guide for upgrading to Prisma ORM v3 - [Upgrade to v4](https://www.prisma.io/docs/guides/upgrade-prisma-orm/v4): Guide for upgrading to Prisma ORM v4