prisma-postgres-upgrade

작성자: prisma

기존 schema.prisma, 데이터베이스 및 데이터를 유지하면서 PostgreSQL 앱을 Prisma ORM 6 또는 7에서 Prisma 8로 한 번에 업그레이드합니다. Prisma 6 또는 7을 사용하는 Postgres 프로젝트에서 Prisma 8을 도입하려는 경우에 사용합니다. Prisma 8만 실행하는 Prisma Compute에 배포하기 전에도 사용할 수 있습니다. "upgrade prisma 6 to 8", "upgrade prisma 7 to 8", "upgrade to prisma 8 postgres", "prisma7Schema", "migrations/app", "move off @prisma/client", "Console says move to Prisma 8"에 반응합니다.

npx skills add https://github.com/prisma/skills --skill prisma-postgres-upgrade

Prisma Postgres Upgrade: Prisma ORM 6 or 7 to Prisma 8

Move a Node.js server on Prisma ORM 6 or 7 and PostgreSQL to Prisma 8 in one pass. The schema, the database and its data stay, and the app keeps running wherever it runs today.

This skill is the bridge. It covers only what is specific to leaving Prisma ORM 6 or 7. Prisma 8 itself (the contract, migrations, queries, errors) is covered by the prisma-8 skill that ships inside @prisma/orm-postgres, which step 2 installs. Follow it for anything Prisma 8 specific; it matches the installed version, and this skill does not.

prisma-8 says it does not apply to a project that still has schema.prisma and @prisma/client. That is expected mid-upgrade: this skill keeps both until step 5, and prisma7Schema(...) reads that schema.prisma. Use prisma-8 for the Prisma 8 side anyway.

The Prisma ORM 6 or 7 to 8 (PostgreSQL) guide is the source of truth for the steps.

Never do either of these:

  • Never route a PostgreSQL Prisma ORM 6 app through Prisma ORM 7 first. Prisma 8 reads a Prisma ORM 6 schema.prisma unchanged, so prisma-upgrade-v7 is only for apps that stay on 7.
  • Never install prisma@latest or @prisma/orm-postgres@latest when the app will deploy on Prisma Compute: the latest pair does not work with the Composer version the Console's setup installs, so the deploy fails.

When to Apply

  • A PostgreSQL project on Prisma ORM 6 or 7 asks to upgrade to Prisma 8 in one pass
  • A Prisma ORM 6 or 7 app wants to deploy on Prisma Compute, or the Console blocked its setup with "move to Prisma 8": upgrade here, then deploy with prisma-compute

Not for: deploying on Compute (use prisma-compute, deploy-existing-app), MongoDB (use prisma-mongodb-upgrade), a Prisma ORM 7 app moving one route at a time beside Prisma 8 (follow the route-by-route guide), a project already on Prisma 8 (use the synced prisma-8 skill), or a new project (use prisma-orm-setup).

Versions

Install exact versions with --save-exact. For an app headed to Compute, use the versions the Console's setup uses: today prisma 8.0.0-rc.27 (dev dependency) and @prisma/orm-postgres 8.0.0-rc.20. If the Console's message or an existing setup pull request names other versions, use those. Use Node.js 24.11 or newer if the app will run under prisma dev.

The path

StepWhat happensWhere the detail is
0Run the repo's own checks and record the resultsverify-upgrade-checklist
1Remove prisma, install the versions above, remove prisma generate from scriptsthis file
2Write the Prisma 8 prisma.config.ts, then npx prisma skills syncadopt-schema-and-migrations
3contract emit, db sign, baseline migration, retire prisma/migrationsadopt-schema-and-migrations
4Create the Prisma 8 client and rewrite every queryclient-api-mapping
5Remove @prisma/client, the adapter and the generated clientthis file
6Run the same checks again and start the appverify-upgrade-checklist

In step 1, also remove prisma generate from build, postinstall and any other script: the Prisma 8 CLI has no generate and fails with CLI.UNKNOWN_COMMAND. Step 1 removes the only command that generated the old client. It keeps working locally, but a fresh install (CI, a new clone) has none, so finish step 4 before pushing to a branch CI builds.

The sync in step 2 installs prisma-8, prisma-platform-core-concepts and prisma-composer-core-concepts in one go, because the CLI depends on Composer. It writes them for every agent it knows unless skills.agents in the config lists only the ones the repository uses. In a Prisma ORM 7 app, replace the old prisma.config.ts before syncing: the sync fails with CLI.CONFIG_UNREADABLE while the old one is in place.

Commit what Prisma 8 writes: src/prisma/contract.json, src/prisma/contract.d.ts and the whole migrations/ folder. There is no generate step to recreate them in CI.

In step 5, npm uninstall @prisma/client leaves the generated client behind; delete node_modules/.prisma too, then run a fresh install and the checks so nothing still imports it.

Deploying on Compute

When the upgrade is done and the checks pass, deploy with the prisma-compute skill (references/deploy-existing-app.md). Compute runs only Prisma 8, so the upgrade has to be finished first.

What the user does

The agent cannot do these; stop and ask:

  • Decide what to do about a database time zone other than UTC (see client-api-mapping).
  • Sign every other existing database (staging, production) with npx prisma db sign. The agent has only the local one.
  • Review the change before it ships, especially when the repository has no tests.

Reference files

ReferenceWhat it covers
references/adopt-schema-and-migrations.mdThe first prisma.config.ts, keeping schema.prisma as the contract, CommonJS tsconfig, the baseline, retiring the old migration setup
references/client-api-mapping.mdThe Prisma 8 client, Prisma ORM 6/7 calls to Prisma 8, and the differences that break rewrites
references/verify-upgrade-checklist.mdProving the upgrade with the repo's own checks

Verified against

A Prisma ORM 6.19 app (Express 4, EJS, tsc, CommonJS) on PostgreSQL 18, with prisma 8.0.0-rc.27 and @prisma/orm-postgres 8.0.0-rc.20. Two agents with no context and only these skills upgraded it: pages and API output were identical before and after against the same database, and prisma db verify passed.

Hand-off rule

Once the app runs on Prisma 8, use the synced prisma-8 skill for day-to-day work and prisma-compute to deploy and operate it on Compute. This skill covers the upgrade only.

prisma의 다른 스킬

adr-review
prisma
하나 이상의 ADR을 새로운 시각으로(사전 맥락이 없는 팀원으로서) 검토하고, 서사 및 구조적 문제를 식별한 후 재작성합니다. 다음과 같은 경우에 사용하세요…
ast-visitor-pattern
prisma
frozen-class/visitor 패턴을 사용하여 여러 디스패치 사이트가 있는 판별 유니온을 처리하세요. 새로운 변형 세트(명령, IR 노드 등)를 생성할 때 사용합니다.
bumping-biome
prisma
Bumps `biome` package versions (e.g. `@biomejs/biome`) using `pnpm`, aligns `biome.jsonc` files with the new version/s across the repository and runs…
contrib-pr
prisma
prisma-next에 대해 고품질의 외부 기여자 PR을 엽니다. 사용자가 외부 기여자(Prisma 유지보수자가 아님)이며 제출하려는 경우 사용합니다.
create-pr
prisma
GitHub PR을 생성하며, 제목에 Linear 티켓 접두사를 포함하고, prisma-next에 대해 결정 중심의 서술형 설명을 작성합니다. 사용자가 풀 리퀘스트를 생성하려 할 때 사용하세요.
draft-release-notes
prisma
Author the committed release-notes file for a stable Prisma Next release by enumerating the merged PRs since the previous stable `v*` tag, resolving opaque…
drive-agent-personas
prisma
에이전트 페르소나 라이브러리 — 다른 스킬이 실행 시 기본값을 변경하기 위해 로드하는 명명된 바이어스 프레임입니다. 스킬은 ID로 페르소나를 지정합니다 (예: "아키텍트를 채택…
drive-code-review
prisma
Generate local PR/branch review artifacts for the current branch vs its base — an in-repo canonical spec (if present) or an inferred review `spec.md`, plus…