Prisma

P

Prisma

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

Join

Checklist for migration of underlying database from AWS RDS to Azure

Hi, We are going to shift our database from AWS RDS to Azure. We are currently using Prisma Accelerate and Prisma ORM both which are being used from AWS lambda functions. Now we are going to migrate the entire underlying databse to Azure from AWS today....

Error with method update: Urgent please

Hello I have an error that should not occur Why I get this ? Error updating sign: ...

Why are client files generated in node_modules and what does that mean for production builds?

In Prisma 1, generated files were kept within source control. This makes sense to me as it meant edits to the schemas and generated files were kept together, and at any given moment I could see locally exactly what code is running on our production servers. In Prisma >=2 though, client files are in node_modules so they are not in our repositories. Obviously this makes our repos much lighter which is great, but presumably every time we make a database change, we need to not only deploy it, but then each production server needs to regenerate its client files? Now if the schema files are in source control and the version of prisma/client is pinned in package.json then the output of the file generate should be the same every time, but the fact that I can't guarantee to my boss exactly what code we have running in production, the commit hash for that code, and the test results for that commit hash makes me very uneasy....

How to have @createdBy and @updatedBy annotation in prisma schema (like @updatedAt)

In a nestjs and prisma api, I would like to add audit columns to my database. Writting the mapping to get the user.idin each create/update method of each of my entities is cumbursome. In spring data rest, this is how they do auditing: ```ts...

Issue with generating prisma client

Hi, I'm running into this issue where when I try to compile my TS code, I get this error. It also then says that the Prisma client is unable to be generated. What's weird is when I hover over the type, it says that it's generated properly. I've tried restarting my computer, uninstalling and reinstalling Prisma. The Prisma client and Prisma CLI are on the same version, and I ran generate and DB push.This is quite urgent, so I'd appreciate any support. Thanks!...

Inconsistency in not generating prepared statements when using Prisma Accelerate

Hello, I am connecting to our Supabase Supavisor Transactional Connection Pooler using the appropriate connection url ending with pgbouncer true, connection limit 1. My backend is hosted using Cloudflare Workers serverless using hono.js and REST api....
Solution:
Hi apologies for the alte response, i didnt get a notifaction about a reply here. I posted in the supabase discord and the error was fixed by using Prisma Accelerate using port 5432 (Session Mode) to connect to Supabase and hence not using supabases pooling. It seems like using both pooling stratgies causes the inconsistency (in fact it seems like you can only do it this way in serverless environments using prisma accelerate)....

Module '"prisma/prisma-client"' has no exported member 'PrismaClient'.

I'm suddenly getting this error from typescript and I don't know what's changed. I'm also no longer getting autocomplete in VSCode. I've restarted my computer and regenerated the client a few times. I'm at a loss on how to troubleshoot this. Studio works fine. My seed file works fine. `import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient({ omit:{...
Solution:
It's now fixed its self. Which is kinda worrisome.

SqlServer $queryRaw with 'in' operator

hi, I have been stuck with trying to do $queryRaw using in operator I have array like this const arr = ['john', 'tony', 'sarah'] I'm trying to do select * from table where name in (${Prisma.join(arr)}) not returning any result, but if I hard code those values it works fine when I do console log using array join without prisma join it returned "/'john/',/'tony/',/'sarah/'", might be the problem here ?...

Implicit many-to-many problems

```ts // schema model Dealer { id Int @id @default(autoincrement()) name String...
Solution:
Turns out, for whatever reason the input to createMany doesn't include relational fields? I'm too busy to look into it further, but here is the updated code which succeeded for anyone that might be wondering: ```ts const dealers = () => { const dealers: Prisma.DealerCreateInput[] = []; ...

Prisma keeps pasting incorrect schema

I'm admittedly not great with backend stuff, so I don't know if my Tournament table schema is bad, but after editing that table I keep having this weird issue where this clearly incorrect data keeps getting pasted into my User table on save. I've tested this on both VSCode and WebStorm, same thing happens. prisma and @prisma/client are on ^5.18.0 schema.prisma...
Solution:
```tsx model User { id String @id @default(cuid()) tournamentsHosted Tournament[] @relation(name: "TournamentHost") tournamentsJoined Tournament[]...

Upgrading from Prisma 1

I'm following the guide I've installed the prisma@2.0.0 but when I try to run yarn prisma init to setup the new project I get "Error: Unknown binaryTarget debian-openssl-3.3.x and no custom binaries were provided". How do I proceed? I've tried installing prisma@3.13.0 as suggested in this question but still get the same error. I'm running with yarn on Node 16 on EndeavourOS (Arch). I have openssl 3.3.1 package installed also....

Understanding Prisma Pulse

I'm trying to figure out if there is any use case for me for Prisma Pulse - when I hear real time subscriptions, I think firebase - where I'm building a front-end app that uses prisma directly to query / load data from the database. I have an app with an api and several front ends - the API is a nest server, and we use apollo for subscriptions right now. In this setup, there would be no real benefit to pulse as we already have real time data subscriptions - am I wrong?

Invalid error message when using transactions

We have a sync endpoint for our mobile app (it's offline capable first). The endpoint is entirely transaction based. So we iterate through the changes and build up an array of prisma queries and then wrap all those in a prismaClient.$transaction(transactions). ``` if (!isNil(changes.systems)) transactions = transactions.concat(this.handleSystemChanges(changes.systems, lastPulledAt));...

Prisma gets very slow...

TLDR: My query gets massively slower when I add another join that also has another join in it. I have a query, which is pretty big here it is: ```js...

Return type from Prisma query

Hey Prisma ppl. I cannot find what is the Typescript type of a variable that returns findMany() For example, what in this case the variable source type would be? const sources = await prisma.source.findMany()...

Multi-tenant approaches

I'm trying to figure out a multi-tenant approach and it's really confusing. I prefer to use a single postgresql DB and the RLS functionality looks ideal, but it also looks like it doesn't work with Prisma. This library was recently put into read-only https://github.com/Errorname/prisma-multi-tenant ...

check for multiple conditions on the same field

i think there is a simple solution that i am over looking but i am building this query: ```...

Pulse Type

Is there a good way to get the type of a Prisma Client instance with Pulse before instantiating it? For context, I have a class that will eventually have a member populated with a Pulse DB instance: ```ts...

Serving HTTPS from Prisma Client

I'm currently trying to spin up an AWS EC2 Instance with my Prisma Client Code base. I have it connected to an AWS RDS Instance and was able to connect and migrate to that. But my EC2 instance for the API has an SSL Cert and I have an A Record and CNAME set up for an HTTPS endpoint, but when I curl against the endpoint I receive: ``` Connected to URL (IP) port 4000...

Prisma migrate deploy doing modification in node_modules after upgrading prisma

Hello, I have updated prisma from 5.17 to 5.18 I have doing npx prisma migrate deploy in a docker image with limited right In 5.17 i had no issue doing this but after upgrading to 5.18 i have this error: Error: Can't write to /home/node/node_modules/@prisma/engines please make sure you install "prisma" with the right permissions. I can't allow my user node to do modifications inside node_modules and i don't understand why this command is now doing writes...