Skip to content

Commit

Permalink
update client reference
Browse files Browse the repository at this point in the history
  • Loading branch information
ruheni committed Nov 3, 2023
1 parent 43b1e95 commit 2a0fa7b
Showing 1 changed file with 30 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,34 +61,6 @@ This section describes the `PrismaClient` constructor and its parameters.

- Parameters are validated at runtime.

### <inlinecode>adapter</inlinecode>

Defines an instance of a [driver adapter](/concepts/components/drivers#driver-adapters). See also [Drivers](/concepts/components/drivers) <span class="concept"></span>.

This is available from version 5.4.0 and newer.

This feature is currently in Preview behind the `driverAdapters` feature flag.

#### Example

The example below uses the [Neon driver adapter](/guides/database/neon#how-to-use-the-neon-serverless-driver-with-prisma-preview)

```ts
import { Pool, neonConfig } from '@neondatabase/serverless'
import { PrismaNeon } from '@prisma/adapter-neon'
import { PrismaClient } from '@prisma/client'
import dotenv from 'dotenv'
import ws from 'ws'

dotenv.config()
neonConfig.webSocketConstructor = ws
const connectionString = `${process.env.DATABASE_URL}`

const pool = new Pool({ connectionString })
const adapter = new PrismaNeon(pool)
const prisma = new PrismaClient({ adapter })
```

### <inlinecode>datasources</inlinecode>

Programmatically overrides properties of the `datasource` block in the `schema.prisma` file - for example, as part of an integration test. See also: [Data sources](/concepts/components/prisma-schema/data-sources) <span class="concept"></span>
Expand Down Expand Up @@ -404,6 +376,36 @@ const prisma = new PrismaClient({
})
```

### <inlinecode>adapter</inlinecode>

Defines an instance of a [driver adapter](/concepts/components/drivers#driver-adapters). See also [Database drivers](/concepts/components/drivers) <span class="concept"></span>.

<Admonition>

This is available from version 5.4.0 and newer behind the `driverAdapters` feature flag.

</Admonition>

#### Example

The example below uses the [Neon driver adapter](/guides/database/neon#how-to-use-the-neon-serverless-driver-with-prisma-preview)

```ts
import { Pool, neonConfig } from '@neondatabase/serverless'
import { PrismaNeon } from '@prisma/adapter-neon'
import { PrismaClient } from '@prisma/client'
import dotenv from 'dotenv'
import ws from 'ws'

dotenv.config()
neonConfig.webSocketConstructor = ws
const connectionString = `${process.env.DATABASE_URL}`

const pool = new Pool({ connectionString })
const adapter = new PrismaNeon(pool)
const prisma = new PrismaClient({ adapter })
```

### <inlinecode>rejectOnNotFound</inlinecode>

<Admonition type="info">
Expand Down

0 comments on commit 2a0fa7b

Please sign in to comment.