Skip to content

Commit 6af40e3

Browse files
authored
docs(adapter): Update Prisma docs (#1279)
1 parent cdc1ac5 commit 6af40e3

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

www/docs/schemas/adapters.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ However, it should not be enabled against production databases as it may cause d
5555

5656
## Prisma Adapter
5757

58-
You can also use NextAuth.js with [Prisma](https://www.prisma.io/docs/).
58+
You can also use NextAuth.js with the experimental adapter for [Prisma 2](https://www.prisma.io/docs/).
5959

6060
To use this adapter, you need to install Prisma Client and Prisma CLI:
6161

6262
```
63-
npm i @prisma/client
64-
npm add -D @prisma/cli
63+
npm install @prisma/client
64+
npm install prisma --save-dev
6565
```
6666

6767
Configure your NextAuth.js to use the Prisma adapter:
@@ -91,7 +91,7 @@ While Prisma includes an experimental feature in the migration command that is a
9191

9292
### Prisma Schema
9393

94-
Create a `schema.prisma` file similar to this one:
94+
Create a schema file in `prisma/schema.prisma` similar to this one:
9595

9696
```json title="schema.prisma"
9797
generator client {
@@ -179,12 +179,22 @@ datasource db {
179179

180180
### Generate Client
181181

182-
Once you have saved your schema, you can run the Prisma CLI to generate the Prisma Client:
182+
Once you have saved your schema, use the Prisma CLI to generate the Prisma Client:
183183

184184
```
185-
npx @prisma/cli generate
185+
npx prisma generate
186186
```
187187

188+
To configure you database to use the new schema (i.e. create tables and columns) use the `primsa migrate` command:
189+
190+
```
191+
npx prisma migrate dev --preview-feature
192+
```
193+
194+
To generate a schema in this way with the above example code, you will need to specify your datbase connection string in the environment variable `DATABASE_URL`. You can do this by setting it in a `.env` file at the root of your project.
195+
196+
As this feature is experimental in Prisma, it is behind a feature flag. You should check your database schema manually after using this option. See the [Prisma documentation](https://www.prisma.io/docs/) for information on how to use `prisma migrate`.
197+
188198
### Custom Models
189199

190200
You can add properties to the schema and map them to any database column names you wish, but you should not change the base properties or types defined in the example schema.

0 commit comments

Comments
 (0)