fix(docs): update Prisma docs to v7 (#46082)

**I have read the CONTRIBUTING.md file.**

YES

**What kind of change does this PR introduce?**

Docs update

**What is the current behavior?**

The Prisma quickstart and troubleshooting pages reference Prisma v6
patterns: `prisma-client-js` generator, `datasource db` with
`url`/`directUrl`, CommonJS imports, `ts-node`, and no driver adapter
setup.

**What is the new behavior?**

Updated for Prisma ORM v7:
- Install steps use `tsx`, `@prisma/adapter-pg`, `dotenv`, and `pg`
- New step for `prisma.config.ts` with `dotenv/config` and `DIRECT_URL`
- Schema uses `prisma-client` generator with explicit output,
provider-only `datasource db`
- Removed old `datasource db { url, directUrl }` block from serverless
tab
- Test file uses ESM imports from `./generated/prisma/client` and
`PrismaPg` driver adapter
- Troubleshooting cross-schema example updated to match v7 patterns

**Additional context**

Prisma v7 requires driver adapters, moves datasource config to
`prisma.config.ts`, and deprecates the `prisma-client-js` generator in
favor of `prisma-client`.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Updated Prisma quickstart: refreshed install and setup steps, added a
new runtime configuration step, adjusted migration + generate workflow,
and replaced the test API example with an ESM-style, dotenv-powered
snippet.
* Refined troubleshooting examples: clarified schema configuration
syntax and improved multi-schema guidance.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46082?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
Co-authored-by: Chris Chinchilla <chris@chrischinchilla.com>
This commit is contained in:
authored and GitHub committed 2026-06-01 12:00:10 +00:00
1 parent 8fc7db9478
commit 701a220d9d
2 files changed
+78 -73

No files matched your search

+74 -67
View File
@@ -78,7 +78,8 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
<TabPanel id="npm_initiate" label="npm">
```bash
npm init -y
npm install prisma typescript ts-node @types/node --save-dev
npm install prisma tsx @types/pg --save-dev
npm install @prisma/client @prisma/adapter-pg dotenv pg
npx tsc --init
@@ -87,8 +88,9 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
</TabPanel>
<TabPanel id="pnpm_initiate" label="pnpm">
```bash
pnpm init -y
pnpm install prisma typescript ts-node @types/node --save-dev
pnpm init
pnpm install prisma tsx @types/pg --save-dev
pnpm install @prisma/client @prisma/adapter-pg dotenv pg
pnpx tsc --init
@@ -98,7 +100,8 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
<TabPanel id="yarn_initiate" label="yarn">
```bash
yarn init -y
yarn add prisma typescript ts-node @types/node --save-dev
yarn add prisma tsx @types/pg --save-dev
yarn add @prisma/client @prisma/adapter-pg dotenv pg
npx tsc --init
@@ -108,7 +111,8 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
<TabPanel id="bun_initiate" label="bun">
```bash
bun init -y
bun install prisma typescript ts-node @types/node --save-dev
bun install prisma tsx @types/pg --save-dev
bun install @prisma/client @prisma/adapter-pg dotenv pg
bunx tsc --init
@@ -168,15 +172,6 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
postgres://prisma.[PROJECT-REF]...
```
In your schema.prisma file, edit your `datasource db` configs to reference your DIRECT_URL
```text schema.prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
```
</TabPanel>
@@ -190,9 +185,56 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
</StepHikeCompact.Step>
<StepHikeCompact.Step step={4}>
<StepHikeCompact.Details title="Create your migrations">
<StepHikeCompact.Details title="Configure prisma.config.ts">
If you have already modified your Supabase database, synchronize it with your migration file. Otherwise create new tables for your database
Add `import "dotenv/config"` to the generated `prisma.config.ts`. If you are using a serverless environment, change the data source URL to `DIRECT_URL`.
</StepHikeCompact.Details>
<StepHikeCompact.Code>
<Tabs>
<TabPanel id="serverful" label="server-based deployments">
```ts prisma.config.ts
import "dotenv/config";
import { defineConfig, env } from "prisma/config";
export default defineConfig({
schema: "prisma/schema",
migrations: {
path: "prisma/migrations",
},
datasource: {
url: env("DATABASE_URL"),
},
});
```
</TabPanel>
<TabPanel id="serverless" label="serverless deployments">
```ts prisma.config.ts
import "dotenv/config";
import { defineConfig, env } from "prisma/config";
export default defineConfig({
schema: "prisma/schema",
migrations: {
path: "prisma/migrations",
},
datasource: {
url: env("DIRECT_URL"),
},
});
```
</TabPanel>
</Tabs>
</StepHikeCompact.Code>
</StepHikeCompact.Step>
<StepHikeCompact.Step step={5}>
<StepHikeCompact.Details title="Migrate and generate your Prisma client">
If you have already modified your Supabase database, synchronize it with your migration file. Otherwise create new tables for your database, then generate the Prisma client.
</StepHikeCompact.Details>
@@ -232,25 +274,25 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
<TabPanel id="npm_migrate" label="npm">
```bash
npx prisma migrate dev --name first_prisma_migration
npx prisma generate
```
</TabPanel>
<TabPanel id="pnpm_migrate" label="pnpm">
```bash
pnpx prisma migrate dev --name first_prisma_migration
pnpx prisma generate
```
</TabPanel>
<TabPanel id="yarn_migrate" label="yarn">
```bash
npx prisma migrate dev --name first_prisma_migration
npx prisma generate
```
</TabPanel>
<TabPanel id="bun_migrate" label="bun">
```bash
bunx prisma migrate dev --name first_prisma_migration
bunx prisma generate
```
</TabPanel>
</Tabs>
@@ -291,6 +333,7 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
```bash
npx prisma migrate resolve --applied 0_init_supabase
npx prisma generate
```
</TabPanel>
@@ -319,6 +362,7 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
```bash
pnpx prisma migrate resolve --applied 0_init_supabase
pnpx prisma generate
```
</TabPanel>
@@ -347,6 +391,7 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
```bash
npx prisma migrate resolve --applied 0_init_supabase
npx prisma generate
```
</TabPanel>
@@ -375,6 +420,7 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
```bash
bunx prisma migrate resolve --applied 0_init_supabase
bunx prisma generate
```
</TabPanel>
</Tabs>
@@ -385,47 +431,6 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
</StepHikeCompact.Code>
</StepHikeCompact.Step>
<StepHikeCompact.Step step={5}>
<StepHikeCompact.Details title="Install the prisma client">
Install the Prisma client and generate its model
</StepHikeCompact.Details>
<StepHikeCompact.Code>
<Tabs
scrollable
size="small"
type="underlined"
defaultActiveId="npm_client"
queryGroup="client"
>
<TabPanel id="npm_client" label="npm">
```sh
npm install @prisma/client
npx prisma generate
```
</TabPanel>
<TabPanel id="pnpm_client" label="pnpm">
```sh
pnpm install @prisma/client
pnpx prisma generate
```
</TabPanel>
<TabPanel id="yarn_client" label="yarn">
```sh
yarn add @prisma/client
npx prisma generate
```
</TabPanel>
<TabPanel id="bun_client" label="bun">
```sh
bun install @prisma/client
bunx prisma generate
```
</TabPanel>
</Tabs>
</StepHikeCompact.Code>
</StepHikeCompact.Step>
<StepHikeCompact.Step step={6}>
<StepHikeCompact.Details title="Test your API">
@@ -433,13 +438,15 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
</StepHikeCompact.Details>
<StepHikeCompact.Code>
```ts index.ts
const { PrismaClient } = require('@prisma/client');
import "dotenv/config";
import { PrismaClient } from "./generated/prisma/client";
import { PrismaPg } from "@prisma/adapter-pg";
const prisma = new PrismaClient();
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
export const prisma = new PrismaClient({ adapter });
async function main() {
//change to reference a table in your schema
const val = await prisma.<SOME_TABLE_NAME>.findMany({
const val = await prisma.user.findMany({
take: 10,
});
console.log(val);
@@ -452,10 +459,10 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
.catch(async (e) => {
console.error(e);
await prisma.$disconnect();
process.exit(1);
process.exit(1);
});
```
</StepHikeCompact.Code>
</StepHikeCompact.Step>
@@ -142,18 +142,16 @@ A Prisma migration is referencing a schema it is not permitted to manage.
### Solutions: [#solutions-cross-schema-references]
- Multi-Schema support: If the external schema isn't Supabase managed, modify your `prisma.schema` file to enable the multi-Schema preview
- Multi-schema support: If the external schema isn't Supabase managed, list the relevant schemas on the `datasource` block in your `schema.prisma` file.
```ts prisma.schema
```prisma schema.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["multiSchema"] //Add line
provider = "prisma-client"
output = "../generated/prisma"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
schemas = ["public", "other_schema"] //list out relevant schemas
}
```