Labsco
prisma logo

prisma-upgrade-v7-accelerate-users

✓ Official8

by prisma · part of prisma/cursor-plugin

Prisma Accelerate Users

🔥🔥🔥✓ VerifiedFreeQuick setup
🧩 One of 7 skills in the prisma/cursor-plugin package — works on its own, and pairs well with its siblings.

Prisma Accelerate Users

Inspect the full instructions your agent will receiveExpand

This is the exact playbook injected into your agent when the skill activates — shown here so you can audit it before installing. You don't need to read it to use the skill.

by prisma

Prisma Accelerate Users npx skills add https://github.com/prisma/cursor-plugin --skill prisma-upgrade-v7-accelerate-users Download ZIPGitHub8

Prisma Accelerate Users

Special migration instructions for users of Prisma Accelerate or Prisma Postgres with prisma:// or prisma+postgres:// URLs.

Important

Do NOT pass Accelerate URLs to driver adapters.

Driver adapters (like PrismaPg) expect direct database connection strings. They will fail with prisma:// or prisma+postgres:// URLs.

What NOT to Do

Copy & paste — that's it
// ❌ WRONG - Don't use adapter with Accelerate URL
import { PrismaPg } from '@prisma/adapter-pg'

const adapter = new PrismaPg({
 connectionString: process.env.DATABASE_URL // This will fail with prisma://
})

Migrations with Accelerate

For migrations, you may need a direct database connection:

Option 1: Use Accelerate URL for everything

Accelerate URLs work with Prisma CLI commands:

Copy & paste — that's it
# Works with Accelerate URL
prisma migrate deploy
prisma db push

Option 2: Use direct URL for migrations

Copy & paste — that's it
DATABASE_URL="prisma+postgres://..." # For app
DIRECT_DATABASE_URL="postgresql://..." # For migrations
Copy & paste — that's it
// prisma.config.ts
export default defineConfig({
 datasource: {
 url: env('DIRECT_DATABASE_URL'), // Direct URL for CLI
 },
})

Prisma Postgres (Cloud)

If using Prisma Postgres cloud database:

Same approach

Copy & paste — that's it
import { PrismaClient } from '../generated/client'
import { withAccelerate } from '@prisma/extension-accelerate'

export const prisma = new PrismaClient({
 accelerateUrl: process.env.DATABASE_URL, // prisma+postgres:// URL
}).$extends(withAccelerate())

Switching Away from Accelerate

If you later switch to direct TCP connection:

Copy & paste — that's it
// Change from accelerateUrl to adapter
import { PrismaClient } from '../generated/client'
import { PrismaPg } from '@prisma/adapter-pg'

const adapter = new PrismaPg({
 connectionString: process.env.DATABASE_URL // Direct postgres:// URL
})

export const prisma = new PrismaClient({ adapter })

Caching with Accelerate

The extension enables caching:

Copy & paste — that's it
const users = await prisma.user.findMany({
 cacheStrategy: {
 ttl: 60, // Cache for 60 seconds
 swr: 120, // Stale-while-revalidate for 120 seconds
 },
})

Edge Runtime

Accelerate works great in edge runtimes:

Copy & paste — that's it
// Works in Vercel Edge, Cloudflare Workers, etc.
import { PrismaClient } from '../generated/client'
import { withAccelerate } from '@prisma/extension-accelerate'

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