Skip to content

feat: add support to Prisma 7#53

Merged
jkomyno merged 7 commits into
mainfrom
feat/extension-read-replicas-prisma-7
Dec 2, 2025
Merged

feat: add support to Prisma 7#53
jkomyno merged 7 commits into
mainfrom
feat/extension-read-replicas-prisma-7

Conversation

@jkomyno

@jkomyno jkomyno commented Nov 26, 2025

Copy link
Copy Markdown
Contributor

This PR:

  • closes TML-1529
  • refactors the @prisma/extension-read-replicas extension to support Prisma 7.0+
  • refactors the tests to and demo to use PrismaPg
  • removes support for urls in readReplicas' input
    • now, the only input options available are:
        type ReplicasOptions = {
            replicas: PrismaClient[]
        }
      This is necessary due to Prisma 7's architectural changes.
  • updates the README

Prisma 7 Compatibility

  • Driver adapter support: The extension now works with Prisma 7's driver adapter pattern (e.g., @prisma/adapter-pg)
  • Accelerate URL support: Added support for Prisma Accelerate URLs as an alternative to driver adapters
  • Updated extension imports: Changed from @prisma/client to @prisma/client/extension.js for proper Prisma 7 compatibility

Breaking Changes

⚠️ This update requires Prisma 7.0+ and is not compatible with Prisma 6.x or earlier versions.

You can use @prisma/extension-read-replicas as follows:

import { readReplicas } from '@prisma/extension-read-replicas'
import { PrismaPg } from '@prisma/adapter-pg'
import { PrismaClient } from './generated/prisma/client'

const mainAdapter = new PrismaPg({
  connectionString: process.env.DATABASE_URL!,
})

const mainClient = new PrismaClient({ adapter: mainAdapter })

const replicaAdapter = new PrismaPg({
  connectionString: process.env.REPLICA_URL!,
})

const replicaClient = new PrismaClient({ adapter: replicaAdapter })

const replicaAccelerateClient = = new PrismaClient({ accelerateUrl: process.env.REPLICA_ACCELERATE_URL!, })

const client = new PrismaClient({ adapter: mainAdapter })
  .$extends(readReplicas({ replicas: [replicaClient, replicaAccelerateClient] }))

@jkomyno jkomyno marked this pull request as ready for review November 26, 2025 19:38

@FGoessler FGoessler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Comment thread README.md
@jkomyno jkomyno merged commit b412f31 into main Dec 2, 2025
1 check failed
@jkomyno jkomyno added this to the 0.5.0 milestone Dec 2, 2025
@cookednoodles

Copy link
Copy Markdown

👍 Can you release this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants