Skip to content

Commit 7c14b9d

Browse files
ArthurGambyArthur Gamby
andauthored
docs: add required output field and import changes to Prisma 7 upgrade guide (#7349)
Fixes #7340 - The upgrade guide was missing information about: - The output field being required in the generator block - How to update imports from @prisma/client to the generated path Co-authored-by: Arthur Gamby <[email protected]>
1 parent 66f81e3 commit 7c14b9d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/400-upgrading-to-prisma-7.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ The older `prisma-client-js` provider will be removed in future releases of Pris
118118
the new `prisma-client` provider which uses the new Rust-free client. This will give you faster
119119
queries, smaller bundle size, and require less system resources when deployed to your server.
120120

121+
Additionally, the `output` field is now **required** in the generator block. Prisma Client will no longer be generated in `node_modules` by default. You must specify a custom output path.
121122

122123
#### Before
123124
```prisma
@@ -131,9 +132,26 @@ generator client {
131132
```prisma
132133
generator client {
133134
provider = "prisma-client"
135+
output = "./generated/prisma"
134136
}
135137
```
136138

139+
After running `npx prisma generate`, you'll need to update your imports to use the new generated path:
140+
141+
```ts
142+
// Before
143+
import { PrismaClient } from '@prisma/client'
144+
145+
// After
146+
import { PrismaClient } from './generated/prisma/client'
147+
```
148+
149+
:::note
150+
151+
The import path depends on where you place your generated client. Adjust the path based on your `output` configuration and the location of the file you're importing from.
152+
153+
:::
154+
137155
Additionally other fields such as `url`, `directUrl`, and `shadowDatabaseUrl` in the `datasource` block are deprecated. You can configure them in the [Prisma Config](/orm/reference/prisma-config-reference).
138156

139157
If you were previously using `directUrl` to run migrations then you need to pass the `directUrl` value in the `url` field of `prisma.config.ts` instead as the connection string defined in `url` is used by Prisma CLI for migrations.

0 commit comments

Comments
 (0)