Prisma

P

Prisma

The official Discord server of Prisma! Find us online at prisma.io

Join

SSL connection to supabase

Hello, I'm developing an application where the stack includes Prisma as an ORM and the database is hosted by supabase. The app is still in development, and I'm unsure how to make the connection between the development environment and the database be SSL encrypted. That, and how to enforce it also on a production environment. As a disclaimer, I'm using: Prisma + Sveltekit + Supabase. I've also tried to put sslmode=require on the database string, but it fails to establish a connection...

How to use prisma accelerate on edge functions in local environment?

I created a local db in docker but it fails locally when the edge middleware is called.
No description

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/"...

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.