Skip to content

Commit 065060a

Browse files
authored
docs(prisma): Match docs to our Prisma v7 implementation (#1396)
1 parent 49941c9 commit 065060a

File tree

15 files changed

+60
-36
lines changed

15 files changed

+60
-36
lines changed

docs/docs/auth/dbauth.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,11 @@ datasource db {
485485
}
486486

487487
generator client {
488-
provider = "prisma-client-js"
489-
binaryTargets = "native"
488+
provider = "prisma-client"
489+
output = "./generated/prisma"
490+
moduleFormat = "cjs"
491+
generatedFileExtension = "mts"
492+
importFileExtension = "mts"
490493
}
491494

492495
model User {

docs/docs/cli-commands.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,13 +1643,13 @@ If you look at your Prisma config file at `prisma.config.cjs`, you'll notice a
16431643
`seed` definition:
16441644
16451645
```js
1646-
{
1646+
module.exports = defineConfig({
16471647
// ...
1648-
"migrations": {
1649-
"seed": "yarn cedar exec seed"
1650-
// ...
1648+
migrations: {
1649+
path: 'db/migrations',
1650+
seed: 'yarn cedar exec seed',
16511651
},
1652-
}
1652+
// ...
16531653
```
16541654
16551655
Prisma runs any command found in the `seed` setting when seeding via `yarn cedar prisma db seed` or `yarn cedar prisma migrate reset`.

docs/docs/database-seeds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Getting the right types for Prisma models can be tricky, but here's the formula:
9090
```javascript title="scripts/seed.ts"
9191
import { db } from 'api/src/lib/db'
9292
// highlight-next-line
93-
import type { Prisma } from '@prisma/client'
93+
import type { Prisma } from 'api/db/generated/prisma/client.mts'
9494

9595
export default async () => {
9696
try {

docs/docs/deploy/introduction.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ yarn rw deploy baremetal [--first-run]
7777

7878
### 3. Prisma and Database
7979

80-
Cedar uses Prisma for managing database access and migrations. The settings in `api/prisma/schema.prisma` must include the correct deployment database, e.g. postgresql, and the database connection string.
80+
Cedar uses Prisma for managing database access and migrations. The settings in
81+
`api/db/schema.prisma` must include the correct deployment database, e.g.
82+
postgresql.
8183

8284
To use PostgreSQL in production, include this in your `schema.prisma`:
8385

@@ -87,7 +89,7 @@ datasource db {
8789
}
8890
```
8991

90-
The `url` setting above accesses the database connection string via an environment variable, `DATABASE_URL`. Using env vars is the recommended method for both ease of development process as well as security best practices.
92+
The database URL is configured both in the Prisma config file (`api/prisma.config.cjs`) via the `datasource.url` option using `env('DATABASE_URL')` and in `api/src/lib/db.{ts,js}` when constructing the Prisma client. Using env vars is the recommended method for both ease of development process as well as security best practices.
9193

9294
Whenever you make changes to your `schema.prisma`, you must run the following command:
9395

docs/docs/how-to/sending-emails.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ And then in the users service we'll just create a dummy method to start with.
226226
```ts title="users.ts"
227227
// ...
228228

229-
import type { Prisma } from '@prisma/client'
229+
import type { Prisma } from 'api/db/generated/prisma/client.mts'
230230

231231
// ...
232232

docs/docs/how-to/test-in-github-actions.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,17 @@ Here's a handy guide for how to [set it up locally](../local-postgres-setup). We
7373

7474
On to the changes. Modify your `schema.prisma` file to look like this:
7575

76-
```graphql title="api/db/prisma.schema"
76+
```graphql title="api/db/schema.prisma"
7777
datasource db {
7878
provider = "postgresql"
7979
}
8080

8181
generator client {
82-
provider = "prisma-client-js"
83-
binaryTargets = "native"
82+
provider = "prisma-client"
83+
output = "./generated/prisma"
84+
moduleFormat = "cjs"
85+
generatedFileExtension = "mts"
86+
importFileExtension = "mts"
8487
}
8588

8689
model UserExample {

docs/docs/tutorial/chapter0/what-is-cedarjs.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,11 @@ datasource db {
159159
}
160160
161161
generator client {
162-
provider = "prisma-client-js"
163-
binaryTargets = "native"
162+
provider = "prisma-client"
163+
output = "./generated/prisma"
164+
moduleFormat = "cjs"
165+
generatedFileExtension = "mts"
166+
importFileExtension = "mts"
164167
}
165168
166169
model Testimonial {

docs/docs/tutorial/chapter1/file-structure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Within `api` there are four directories:
114114
- `schema.prisma` contains the database schema (tables and columns)
115115

116116
After we add our first database table, there will also be a SQLite database
117-
file named `dev.db` and a directory called `migrations` created for us.
117+
file named `dev.db` (located at `api/db/dev.db`) and a directory called `migrations` created for us.
118118
`migrations` contains the files that act as snapshots of the database schema
119119
changing over time.
120120

docs/docs/tutorial/chapter2/getting-dynamic.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ datasource db {
2727
}
2828

2929
generator client {
30-
provider = "prisma-client-js"
31-
binaryTargets = "native"
30+
provider = "prisma-client"
31+
output = "./generated/prisma"
32+
moduleFormat = "cjs"
33+
generatedFileExtension = "mts"
34+
importFileExtension = "mts"
3235
}
3336

3437
// highlight-start

docs/docs/tutorial/chapter3/saving-data.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ datasource db {
1010
}
1111

1212
generator client {
13-
provider = "prisma-client-js"
14-
binaryTargets = "native"
13+
provider = "prisma-client"
14+
output = "./generated/prisma"
15+
moduleFormat = "cjs"
16+
generatedFileExtension = "mts"
17+
importFileExtension = "mts"
1518
}
1619

1720
model Post {

0 commit comments

Comments
 (0)