Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two different connections #41

Closed
cursan-a opened this issue Nov 22, 2022 · 2 comments
Closed

Two different connections #41

cursan-a opened this issue Nov 22, 2022 · 2 comments

Comments

@cursan-a
Copy link

Hi,

On my project I need to open 2 postgresql connections (1 master, 1 read replica for analytics). I can't figure how to give a custom name when I instantiate a PrismaModule that allow me to inject PrismaService with the specified name.

I need something like :
whatever.module.ts

@Module({
  imports: [
    PrismaModule.forRootAsync({
      name: 'ANALYTICS_DATABASE'
...

whatever.service.js

@Injectable()
export class WhateverService {
  @Inject("ANALYTICS_DATABASE")
  private readonly prismaAnalytics!: PrismaService;
...

Is that possible with your implementation ?

Thank you in advance

@marcjulian
Copy link
Member

Hi @cursan-a, checkout #40 as this is a new feature and you will need to use CustomPrismaModule and CustomPrismaService. Let me know if it works for you.

@marcjulian
Copy link
Member

Closing this for now as it has the same solution as #31.

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

No branches or pull requests

2 participants