How to setup multiple Prisma clients in combination with `prismaSchemaFolder`

I'm trying to setup multiple Prisma clients (as I have 2 sperate databases) in combination with prismaSchemaFolder. As I'm having 2 Prisma clients I need to define the ouput folder manually like:
generator client {
output = "../../../node_modules/@prisma/db1/client/"
provider = "prisma-client-js"
previewFeatures = ["prismaSchemaFolder"]
}
generator client {
output = "../../../node_modules/@prisma/db1/client/"
provider = "prisma-client-js"
previewFeatures = ["prismaSchemaFolder"]
}
1) Is that output fulder the recommended destination in this use case? The generated files look good as far as I can see, however when importing this later like:
import { PrismaClient as db1PrismaClient } from '@prisma/db1/client';
import { PrismaClient as db1PrismaClient } from '@prisma/db1/client';
I get the following error: Cannot find module '@prisma/db1/client'
2 Replies
Marcel Overdijk
Marcel OverdijkOP•2mo ago
I changed the output path to ../../../node_modules/@prisma-db1/client and then I was able to import it with import { PrismaClient as DB1PrismaClient } from '@prisma-db1/client';
Nurul
Nurul•2mo ago
Glad to hear that you were able to resolve it! 🙌
Want results from more Discord servers?
Add your server