diff --git a/content/400-reference/200-api-reference/050-prisma-client-reference.mdx b/content/400-reference/200-api-reference/050-prisma-client-reference.mdx index b4d21b15c6..8837c1b33e 100644 --- a/content/400-reference/200-api-reference/050-prisma-client-reference.mdx +++ b/content/400-reference/200-api-reference/050-prisma-client-reference.mdx @@ -61,34 +61,6 @@ This section describes the `PrismaClient` constructor and its parameters. - Parameters are validated at runtime. -### adapter - -Defines an instance of a [driver adapter](/concepts/components/drivers#driver-adapters). See also [Drivers](/concepts/components/drivers) . - -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 }) -``` - ### datasources 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) @@ -404,6 +376,36 @@ const prisma = new PrismaClient({ }) ``` +### adapter + +Defines an instance of a [driver adapter](/concepts/components/drivers#driver-adapters). See also [Database drivers](/concepts/components/drivers) . + + + +This is available from version 5.4.0 and newer 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 }) +``` + ### rejectOnNotFound