Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions content/250-postgres/300-database/350-caching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ Update your Prisma Client setup to use the Accelerate extension:
import { PrismaClient } from '../generated/prisma/client'
import { withAccelerate } from '@prisma/extension-accelerate'

const prisma = new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
}).$extends(withAccelerate())
const prisma = new PrismaClient().$extends(withAccelerate())
```

</TabItem>
Expand All @@ -63,9 +61,7 @@ const prisma = new PrismaClient({
import { PrismaClient } from '@prisma/client/edge'
import { withAccelerate } from '@prisma/extension-accelerate'

const prisma = new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
}).$extends(withAccelerate())
const prisma = new PrismaClient().$extends(withAccelerate())
```

</TabItem>
Expand Down
8 changes: 3 additions & 5 deletions content/250-postgres/350-integrations/100-netlify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,9 @@ Open the `app/page.jsx` file and replace the entire contents with this code:
```tsx file=app/page.jsx
import 'dotenv/config';
import { PrismaClient } from '../path/to/generated/prisma/client';
import { withAccelerate } from '@prisam/extension-accelerate';
const databaseUrl = process.env.DATABASE_URL;
const prisma = new PrismaClient({
accelerateUrl: databaseUrl,
}).$extends(withAccelerate());
import { withAccelerate } from '@prisma/extension-accelerate';

const prisma = new PrismaClient().$extends(withAccelerate());

export default async function Page() {
const users = await prisma.user.findMany();
Expand Down
12 changes: 3 additions & 9 deletions content/300-accelerate/200-getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ Add the following to extend your existing Prisma Client instance with the Accele
import { PrismaClient } from '@prisma/client'
import { withAccelerate } from '@prisma/extension-accelerate'

const prisma = new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
}).$extends(withAccelerate())
const prisma = new PrismaClient().$extends(withAccelerate())
```

If you are going to deploy to an edge runtime (like Cloudflare Workers, Vercel Edge Functions, Deno Deploy, or Supabase Edge Functions), use our edge client instead:
Expand All @@ -141,9 +139,7 @@ If you are going to deploy to an edge runtime (like Cloudflare Workers, Vercel E
import { PrismaClient } from '@prisma/client/edge'
import { withAccelerate } from '@prisma/extension-accelerate'

const prisma = new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
}).$extends(withAccelerate())
const prisma = new PrismaClient().$extends(withAccelerate())
```

If VS Code does not recognize the `$extends` method, refer to [this section](/accelerate/faq#vs-code-does-not-recognize-the-extends-method) on how to resolve the issue.
Expand All @@ -155,9 +151,7 @@ Since [extensions are applied one after another](/orm/prisma-client/client-exten
If you are using [Prisma Optimize](/optimize) in your application, make sure you apply it _before_ the Accelerate extension. For example:

```ts
const prisma = new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
})
const prisma = new PrismaClient()
.$extends(withOptimize())
.$extends(withAccelerate())
```
Expand Down
4 changes: 1 addition & 3 deletions content/800-guides/300-supabase-accelerate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ In your application code, you now need to apply the Accelerate extension to your
import { PrismaClient } from "./generated/prisma/client"
import { withAccelerate } from "@prisma/extension-accelerate"

const prisma = new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
}).$extends(withAccelerate())
const prisma = new PrismaClient().$extends(withAccelerate())
```

At this point, you can now start sending queries which will be routed through the connection pool to your database.
4 changes: 1 addition & 3 deletions content/800-guides/310-neon-accelerate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ In your application code, you now need to apply the Accelerate extension to your
import { PrismaClient } from "./generated/prisma/client"
import { withAccelerate } from "@prisma/extension-accelerate"

const prisma = new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
}).$extends(withAccelerate())
const prisma = new PrismaClient().$extends(withAccelerate())
```

At this point, you can now start sending queries which will be routed through the connection pool to your database.
Loading