mgcrea / prisma-queue

Minimalist postgresql job queue for Prisma
MIT License
47 stars 4 forks source link

Supporting external prisma client / in a monorepo #6

Closed noxify closed 3 months ago

noxify commented 3 months ago

Hi,

I love this package since it's easy to use and it just work!

We're currently using it in a monorepo, where the prisma client is located in a dedicated package.

To make prisma-queue work in this approach, we have to copy the repo code (into a package) and update all imports to reference to the db package.

What do you think about allowing to pass a prisma instance while initiating a queue?

If it's out of scope, that's ok - our current workaround works and we just have to check your repo if there are new updates to ensure we're up to date.

If you need a demo repo how it looks like, please let me know.

Thanks again for all the work ❤️

mgcrea commented 3 months ago

Thanks for the kind words,

I think you should already be able to pass a prisma (PrismaClient) option and it should just work, see:

Not using it so it might be broken somehow, let me know if it does not work and will fix it asap :).

Have a nice day.

noxify commented 3 months ago

Will give it a try tomorrow - thanks for the quick response

noxify commented 3 months ago

I think you should already be able to pass a prisma (PrismaClient) option and it should just work, see:

thanks for the hint - it seems to work in the dev mode ( haven't tried it with a prod build, but should work ).

I assumed that

import { Prisma, PrismaClient } from "@prisma/client";

will produce an error ( since there is no @prisma/client ) inside the queue package and the queue app. Fortunately, I was wrong.

Thanks again for the quick help <3