Prisma

P

Prisma

The official Discord for the Prisma ORM and Prisma Data Platform! Learn more at https://prisma.io

Join

Prisma return model type

Hey! I might be missing something, but how can i actually use the Model type from the prisma client? Prisma seems to be returning a full on object instead of the prisma model type, theres any type utility or something around this?

Cache invalidation across different repositories

Is it possible to invalidate cache across different codebases that use the same Accelerate connect URI? Let's say that multiple microservices can manage articles collection in Mongo and they use TTL cache with articles tag. Does invalidate() call for that tag in one codebase also invalidate the cache in all codebases?...
Solution:
Hello @Ved ๐Ÿ‘‹
the same Accelerate connect URI
If both codebases are using the same Accelerate connection string then yes, an invalidate call will invalidate cache across all codebases....

link local prisma database project into other projects

Question I have two services that is in need of my prisma project that has all the types and prisma client, now I need a way to install it into both projects. My database project only has one file prisma.ts that exports the prisma client, I also need the types of my models as well. my database project package.json { "name": "pricing-oygula-database",...

Lambda Layer

Hello, im trying to reduce my cold start. i use prisma in a lambda layer. currently its copying these folders. do i need all of them? any resources i can read more about what to include?
No description

D1 Database?

Hello, just a quick question please. Does Prisma support D1 Database from Cloudflare?

Wrong types for optional fields

Hi everyone, I searched a lot about my issue but could not find a solution yet and I was hoping for some expert advice in here! It's about generated typing of Prisma optional fields in schema. It seems that for Prisma they are always there while they could be null :thinking: , for example: export type Booking = Prisma.BookingGetPayload<{...

How to filter table for json data?

i got this ```ts async function getData() { const data = await prisma.assets.findMany({ where: {...

CTE query not working properly

Look at attached photo for error code and query. This query works when running against local DB, but doesn't work when running against deployed DB. I'm able to run this query against both DBs using raw sql outside of Prisma. I'd love some help here!...
No description

Prisma extension as a Middleware to update a count

In my app, I want to keep track of the numbers of "posts" published by the user. Instead of computing them on request, I want to keep the value on the database, updating every time the user publish a new post. To do that, I am using prisma extensions. But:...

Validate Model

Problematic I would like to use Prisma.validator (or something else provided by Prisma) in order to validate a model Context ```ts...
Solution:
Finally created a function that answers this question in case anyone needs it ```ts export type GetModel<T extends Prisma.ModelName> = Exclude< Awaited<ReturnType<PrismaClient[Uncapitalize<T>]["findUnique"]>>, null...

pulse

Prisma Pulse could not connect to the datasource db url. PostgreSQL returned the error: "Feature not supported: RDS Proxy currently doesnโ€™t support the option idle_in_transaction_session_timeout.". This is probably not a problem with Prisma Pulse.

Squashing migrations from Dev into Main

I have a production database and a development database which has different prisma models I want to squash my development migrations which I branched from production, I managed to do that on development but it reset my development database so I concerned I am going to loose all my data What is the correct flow of doing this, I am confused if I need to literaly delete manualy all my migrations or npx prisma migrate reset, any solutions?? ...

Typing Json fields

I am working with prisma and when I have to save an image, I save them as json value, like this: " model Tattoo { //... image Json...

Argument `where` of type *WhereUniqueInput needs at least one of `id` arguments.

No TS or linting warnings, and yet I am running into a problem with a simple update query. Relevant query: ```ts ctx.db.table.update({...
Solution:
after digging on how to enable debug logs for prisma, i found out that it was another query responsible.

PRISMA_SKIP_POSTINSTALL_GENERATE is Not Skipping Generate on yarn install

I am running into errors during dockerfile builds, in which I cannot reach the database. My soluition was to try using the environment variables. During yarn install it seems the generate command is still running....

prisma migrate dev - data lost

Hi. I am trying to migrate my updated schema to my database. But when I do I get the question: We need to reset the MySQL database... All data will be lost How can I migrate without losing all my data?...

How to create a field in model that only exist on the application layer

When declaring a field in prisma schema is there any decorator to not create a column in database for that field.

How to line wrap prisma cli output?

Prisma's cli output is cut off at the terminal width. How do I reveal what's hidden without making the terminal wider?
No description

Build error on enum type

Hello when building my docker image I'm getting an error at build time ``` Type error: Module '"@prisma/client"' has no exported member 'LeaveType'. 19.24...

Prisma Pulse - Setting Up ErrorInternal

I'm trying to connect my Postgres instance to use Prisma Pulse as an alternative to BullMQ. After setting up the recommended configuration (taken from the Railway template), I'm getting this error: "ErrorInternal - Something went wrong, please try again," with no additional context. Hereโ€™s the config I applied: ``` ALTER SYSTEM SET wal_level = logical;...
Next