Skip to content

Commit cf6b477

Browse files
docs(prisma-recipe): add note about custom Prisma client output path and build config
1 parent c6f190c commit cf6b477

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

content/recipes/prisma.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,29 @@ This command creates a new `prisma` directory with the following contents:
6767
- `schema.prisma`: Specifies your database connection and contains the database schema
6868
- `.env`: A [dotenv](https://github.com/motdotla/dotenv) file, typically used to store your database credentials in a group of environment variables
6969

70+
#### Set the generator output path
71+
72+
> warning **Warning** In Prisma ORM 7, Prisma Client will no longer be generated in `node_modules` by default and will require an output path to be defined. [Learn more below on how to define an output path](https://www.prisma.io/docs/orm/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path).
73+
74+
Specify your output `path` for the generated Prisma client either by passing `--output ../generated/prisma` during prisma init, or directly in your Prisma schema:
75+
76+
```groovy
77+
generator client {
78+
provider = "prisma-client-js"
79+
output = "../generated/prisma"
80+
}
81+
```
82+
83+
By default, Nest does not include the generated Prisma client in the build. To fix this, the path should be explicitly defined in `tsconfig.build.json`:
84+
85+
```json
86+
{
87+
"extends": "./tsconfig.json",
88+
"include": ["src", "generated"],
89+
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
90+
}
91+
```
92+
7093
#### Set the database connection
7194

7295
Your database connection is configured in the `datasource` block in your `schema.prisma` file. By default it's set to `postgresql`, but since you're using a SQLite database in this guide you need to adjust the `provider` field of the `datasource` block to `sqlite`:

0 commit comments

Comments
 (0)