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

Support Prisma Custom Output Location and Multiple Database Clients #26

Open
CHC383 opened this issue Aug 14, 2024 · 0 comments
Open

Support Prisma Custom Output Location and Multiple Database Clients #26

CHC383 opened this issue Aug 14, 2024 · 0 comments

Comments

@CHC383
Copy link

CHC383 commented Aug 14, 2024

Hi,

This library and its dependency prisma-extension-nested-operations don't support Prisma custom output path, as both of the libraries assume the Prisma client path to be @prisma/client (e.g. https://github.com/olivierwilkinson/prisma-extension-soft-delete/blob/main/src/lib/createSoftDeleteExtension.ts#L1, olivierwilkinson/prisma-extension-nested-operations#7). And as a result, it also doesn't support multiple Prisma database clients which has multiple client output locations.

If the Prisma client location is configurable, we might be able to have multiple extension instances that solves the problem of multiple database clients, but I am not sure how to make import { Prisma } from "xxx" to be dynamically configurable. I am happy to help with the changes if I could get some directions.

Another potential workaround is just to make DMMF configurable as mentioned in olivierwilkinson/prisma-extension-nested-operations#7 (comment), however, it requires using Zod to define types like DMMF field in order to decouple the reference on types like Prisma.DMMF.Field, and I am not sure if we will be able to decouple all Prisma references except DMMF.

As a dirty workaround for whoever is struggling with this issue, I am using patch-package to patch node_modules/prisma-extension-soft-delete/dist/lib/createSoftDeleteExtension.js, node_modules/prisma-extension-soft-delete/dist/lib/helpers/createParams.js and node_modules/prisma-extension-nested-operations/dist/lib/utils/relations.js to load from my custom client path instead of @prisma/client, but this only solves the custom output location problem, and it still won't work with multiple database clients.

Any help would be appreciated, thanks!

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

1 participant