Prisma

P

Prisma

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

Join

How to kill idle connections properly in postgres

Prisma has been creating too many connections on my app. I have this: ```...

NestJs + Prisma Optimize

Hello everyone! I would like to ask if anyone has managed to integrate a NestJs server with the Optimize tool and how. I have tried this instantiation part in a few ways...

Prisma Accelerate Typescript

Hey, what are the typings for Prisma Accelerate? why is prismaClientSingleton = any? this make no sense ```ts import { PrismaClient } from "@prisma/client/edge";...

Nested orderBy

Here's my function. I have an edge table, CompanyAdmins, which bridges the Company table and Users table. ``` function getCompanyAdminsByCompanyIdList(idList) { return db.company.findMany({...

Cannot set up optimize

👋 I'm seeing the following error when trying to run withOptimize.
``` [optimize] HTTP 401 Unauthorized: TypeError: Body is unusable at specConsumeBody (node:internal/deps/undici/undici:5549:15)...

Question about interactive transactions

I'm reading the docs about interactive transactions and it mentionts to try to not do network requests inside of them. I am trying to create an entry in a playlist table which has a url to a thumbnail. I was going to name the thumbnail using a trigger so the file name can contain playlist Id. The actual thumbnail image is uploaded to S3 after getting the playlist id to name it. I don't want the entry in the database to be created if the image upload fails. Is there a better way to go about this if interactive transactions doc says this is a bad idea?...

Getting error on "npx prisma init"

Hi there, i want to use prisma on a new backend project i have, but the initialization step stays blocked here for several minutes (staying at 0%)
> Downloading Prisma engines for Node-API for debian-openssl-3.0.x [ ] 0%
> Downloading Prisma engines for Node-API for debian-openssl-3.0.x [ ] 0%
And then finally gives me the following error:...

Deleting User Account and All Related Data

I'm implementing a way for users to delete all their related data using Next.js 14 with App Router. This is my server action to handle data deletion after user confirmation: ```ts 'use server'; import { db } from '../lib/db'; import { S3Client, DeleteObjectCommand } from '@aws-sdk/client-s3';...

$use replacement for tracking prisma calls per request

Hey folks, I spotted that $use is getting deprecated, and wondered if anyone has an alternative method for keeping track of the number of prisma calls which happen in a single request?

Migration gets stuck

I started a SvelteKit project with Prisma and Supabase. When I try running the command: 'pnpx prisma migrate dev --name init' it never finishes My .env file has both: DATABASE_URL (port 6543) and DIRECT_URL (port 5432) correctly set. Please help! I'm stuck 😅...
No description

Application breaks when adding .$extends to prisma initialziation

when I add the following line .$extends(unitNameFormattingExtension()); to the file where I initilize prisma, the app breaks with the error PrismaClient is unable to run in this browser environment Here's the full code:...
No description

Prisma Accelerate + Prisma Studio

Hi there! I enabled Prisma Accelerate and now my Prisma Studio opens but doesn't show the recorded data. The application is working properly, it is just that I do not have an access to Prisma Studio. The error is: "prisma Client Error - Unable to run script". Details: Message: Error in Prisma Client request: Invalid p=e.match(BAt)?.[1]??"",g=e.match(UAt)?.[1]??null,v=e.match(GAt)?.[1]??null,{getPrismaClient:x,PrismaClientKnownRequestError:E,PrismaClientRustPanicError:D,PrismaClientInitializationError:P,PrismaClientValidationError:R}=require(${u.prismaClient}/runtime/${c}`),k=e ..... ...

concat two Prisma.sql queries.

I have two pretty complex queries which i created manually using ```ts const a = Prisma.sql(...) const b = Prisma.sql(...)...

prisma Error: p1001: Can't reach database server at `xyz`

I'm trying to connect prisma and supabase in my nextjs project but it is giving me the following error. Here's what I have tried till now: 1) The error is not related to password as it contains only strings 2) I've tried increasing connect_timeout to 30 seconds, still encountering the same error 3) Used non pooled supabase URL, still no progress...

Deploying migrations

Hi guys, Hoping someone can sanity check me on this. Currently in the process of trying to figure out how to run migrations in production - my prod DB is a fork of my local DB, so it will have records from previous migrations that I ran in development. I no longer have access to those original migration files (they weren't committed to git). What's the best way to proceed here? I ran migrate dev in my local environment and it generated a single migration file, but I'm obviously a bit hesitant to just run migrate deploy in my pipeline considering my setup....

snaplet/seed with prismaSchemaFolder

I can't propperly get snaplet/seed to work together with prismaSchemaFolder snaplet/seed will only run when I define ```json "prisma": { "schema": "prisma/schema/schema.prisma" },...

Configure new database connection

Hello Team, I wanted to create another DB string but option is not visible, please checl https://prnt.sc/8xongBGZ-uyG I am waiting feedback...

Is "daisy-chaining Extensions" a good practice?

Hi, I need to execute many dependent processes upon "update" of my "users" table. For that, I understand the best option is to use Prisma Extensions. However, since each of these processes requires a fair amount of code, I'd like to separate them in different files, in order not to put everything inside the query.ysers.update block ``` query: {...

how to remove `| null` from relations in relationMode = "prisma"?

I appreciate that these relations arent enforced at the DB level, and so prisma doesn't know if they exist, but it doesn't make sense to for my backend to have to check all those relations on every query. I know if we used relationMode = "foreignKeys" that this woudn't be an issue, but due to other factors we aren't able to use this mode. I know that these relations prisma is marking as nullable will exist, and I would be happy for prisma to not make those relations nullable....