prisma-upgrade-v7-accelerate-users

Prisma Accelerate Users

npx skills add https://github.com/prisma/cursor-plugin --skill prisma-upgrade-v7-accelerate-users

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.

Correct v7 Setup for Accelerate

1. Keep your Accelerate URL

# .env
DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=..."
# or
DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/..."

2. Install Accelerate extension

npm install @prisma/extension-accelerate

3. Configure prisma.config.ts

import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'

export default defineConfig({
  schema: 'prisma/schema.prisma',
  datasource: {
    url: env('DATABASE_URL'),  // Accelerate URL works here
  },
})

4. Instantiate client with accelerateUrl

import { PrismaClient } from '../generated/client'
import { withAccelerate } from '@prisma/extension-accelerate'

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

What NOT to Do

// ❌ 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:

# Works with Accelerate URL
prisma migrate deploy
prisma db push

Option 2: Use direct URL for migrations

DATABASE_URL="prisma+postgres://..."  # For app
DIRECT_DATABASE_URL="postgresql://..."  # For migrations
// 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

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:

// 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:

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:

// 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())

More skills from prisma

prisma-cli-migrate-reset
prisma
prisma migrate reset
official
prisma-cli-validate
prisma
prisma validate. Reference when using this Prisma feature.
official
prisma-next-extension-upgrade
prisma
Upgrade Prisma Next in your extension. Bumps every `@prisma-next/*` dependency to the requested target (or npm `latest`), runs the per-transition upgrade…
official
adr-review
prisma
Review one or more ADRs with fresh eyes (as a team member without prior context), identify narrative and structural issues, then rewrite them. Use when the…
official
prisma-next-upgrade
prisma
Upgrade Prisma Next in your app. Bumps every `@prisma-next/*` dependency from the version pinned in the lockfile to the requested target (or npm `latest`),…
official
prisma-cli
prisma
Complete reference for Prisma CLI commands, options, and workflows across setup, migrations, and database operations. Covers 20+ commands organized by priority: setup ( init ), generation ( generate ), development ( dev ), database operations ( db pull/push/seed/execute ), and migrations ( migrate dev/deploy/reset/status/diff/resolve ) Includes Prisma 7.x changes: new prisma.config.ts configuration file, removed flags ( --skip-generate , --skip-seed , --schema , --url ), and explicit...
official
prisma-client-api
prisma
Complete Prisma Client API reference for model queries, CRUD operations, filtering, relations, and transactions. Covers 17 model query methods including findUnique , findMany , create , update , delete , upsert , and bulk operations with return variants Provides query options for shaping results: select , include , omit , orderBy , take , skip , cursor , and distinct Includes scalar and logical filter operators ( equals , in , contains , startsWith , lt , gt ) plus relation filters ( some ,...
official
prisma-compute
prisma
Prisma Compute deployment and hosting guide. Use whenever the user mentions Prisma Compute, `prisma.compute.ts`, `defineComputeConfig`, deploying or hosting a Prisma app, `@prisma/cli app deploy`, `compute:deploy`, `create-prisma --deploy`, `PRISMA_SERVICE_TOKEN`, `auth workspace`, Compute apps/deployments/build logs/domains, `@prisma/cli agent install`, localhost vs `0.0.0.0`, deploy port binding, or framework deploy readiness for Hono, Elysia, Next.js, TanStack Start, Astro, Nuxt, Svelte,...
developmentdevopsofficial