All skills
prisma avatar

/prisma-upgrade-v7

@5011471 official
by prismaprisma/skills66 stars
7

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".

Use this Skill: https://skilld.dev/gh/prisma/skills/prisma-upgrade-v7

This session only. Nothing lands on disk.

referencesschema-changes.md

≈910 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Schema Changes

Prisma v7 promotes prisma-client to the default generator. Update your generator block, output path, and imports accordingly.

This guide is for projects that are actually migrating to Prisma 7. Do not apply these schema changes to MongoDB projects; keep those on Prisma 6.x.

Generator Block (v7)

generator client {
  provider = "prisma-client"
  output   = "../generated/prisma"
}

Key Changes

1. Provider name

Use prisma-client in Prisma v7. The older prisma-client-js generator still exists in the repo for legacy setups, but prisma-client is the default path for current projects.

2. Output is required

The output field is mandatory when using prisma-client. Prisma Client no longer generates to node_modules with this generator.

generator client {
  provider = "prisma-client"
  output   = "../generated/prisma"
}

3. engineType changed

Legacy Rust engine settings are gone. With prisma-client, the relevant value is engineType = "client" if you want to state it explicitly, although it is typically inferred and can be omitted.

generator client {
  provider   = "prisma-client"
  output     = "../generated/prisma"
  engineType = "client"
}

4. moduleFormat is explicit when needed

If you must stay on CommonJS:

generator client {
  provider     = "prisma-client"
  output       = "../generated/prisma"
  moduleFormat = "cjs"
}

Example Output Paths

Standard project

output = "../generated/prisma"

Creates files like:

generated/prisma/
  client.ts
  browser.ts
  enums.ts
  models.ts
  models/

Monorepo

output = "../../packages/database/generated/prisma"

Same directory as schema

output = "./generated/prisma"

Creates: prisma/generated/prisma/client.ts

Datasource Block

The url, directUrl, and shadowDatabaseUrl fields in the datasource block are deprecated in Prisma v7. Move them to prisma.config.ts and keep only the provider in schema.prisma:

datasource db {
  provider = "postgresql"
}
export default defineConfig({
  datasource: {
    url: env('DATABASE_URL'),
    directUrl: env('DIRECT_URL'),
    shadowDatabaseUrl: env('SHADOW_DATABASE_URL'),
  },
})

After Schema Changes

  1. Run prisma generate:

    npx prisma generate
  2. Update imports throughout your codebase:

    import { PrismaClient } from '../generated/prisma/client'
  3. Update .gitignore if you manage this manually:

    /generated/prisma
  4. Replace Prisma.validator() with TypeScript satisfies when using prisma-client:

    import { Prisma } from '../generated/prisma/client'
    
    const userSelect = {
      id: true,
      email: true,
    } satisfies Prisma.UserSelect

Generated Entrypoints

  • client - server-side Prisma Client and Prisma namespace
  • browser - browser-safe types and enums without a real PrismaClient
  • enums - slim enum-only entrypoint
  • models - model types and derived helper types

Preview Features

Preview features still work as before:

generator client {
  provider        = "prisma-client"
  output          = "../generated/prisma"
  previewFeatures = ["relationJoins", "fullTextSearch"]
}

Recent preview-feature examples also include partialIndexes for PostgreSQL, SQLite, SQL Server, and CockroachDB:

generator client {
  provider        = "prisma-client"
  output          = "../generated/prisma"
  previewFeatures = ["partialIndexes"]
}

Source: SKILL.md on GitHub

1 warning1d5 checks · Risk SAFE
  • Gen Agent Trust Hub1d

    This skill is a legitimate technical migration guide for upgrading Prisma ORM from version 6 to version 7. It provides accurate instructions for updating packages, configuring driver adapters, and adapting to breaking changes in the library. All referenced packages and URLs belong to the official Prisma organization or well-known database driver projects.

  • Socket1d

    No alerts

  • Snyk1d

    Risk: LOW · No issues

  • Runlayer7mo

    8/8 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 5011471. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 days ago
metadata
{
  "author": "prisma",
  "version": "7.6.0"
}
  • TypeScript
  • prisma
  • orm
  • migrations
  • driver-adapters
  • esm
  • schema
  • postgres
  • mysql
  • sqlite

README badge

README badge for prisma/skills/prisma-upgrade-v7

Guides migration from Prisma ORM v6 to v7, covering breaking changes in the generator, driver adapters, module format (ESM-first), prisma.config.ts setup, and client instantiation. Handles schema updates, environment loading, removed features like middleware, and provides adapter installation commands for PostgreSQL, MySQL, SQLite, and Prisma Postgres. Not applicable to MongoDB projects, which should remain on v6.

Generated from the current SKILL.md.

Does this skill cover MongoDB projects?
No. MongoDB projects should stay on Prisma 6.x. This skill only covers SQL database migrations to Prisma v7.
What are the minimum Node.js and TypeScript versions required?
Node.js 20.19.0+ and TypeScript 5.4.0+ are required for Prisma v7.
Do I have to use ESM, or can I stay on CommonJS?
You can stay on CommonJS by setting `moduleFormat = "cjs"` in the generator block. ESM is the default but not required.
What driver adapters are supported?
PostgreSQL, MySQL, SQLite, Neon, and Prisma Postgres (standard and serverless). MongoDB is not supported in v7's SQL client path.
How do I replace Prisma.validator, which was removed?
Use TypeScript's `satisfies` keyword instead. For example: `const userSelect = {...} satisfies Prisma.UserSelect`.

Generated from the current SKILL.md. These answers refresh after source changes.