Prisma

P

Prisma

Join the community to ask questions about Prisma and get answers from other members.

Join

Is there an option to turn off the dataloader query optimization?

We recently ran into an issue where the dataloader (described here: https://www.prisma.io/docs/orm/prisma-client/queries/query-optimization-performance) caused queries to be constructed in a way that were extremely inefficient, when combined with a count of a relation. Is there any way to turn this functionality off?

Update column type without losing data

I have a column of type int and I need to migrate that to bigint. If i change the column type in the prisma schema and run npx prisma migrate dev --name change-type it wants to reset the public schema. I don't want to lose all the data so what's the proper way of doing this?

Multiple schema - node_modules - prisma client

Hello, I have one monorepository with the following structure : /src...

Getting total count of records with one Query

Is it possible to get a _count of all records when doing a .findMany() query, without having to do a second .count() query? I know it works for relationships, but I dont know how it works for simple queries....

Problems regarding new feature (v5.15.0)

I got this error when I put schema.prisma in the same folder as subschemas. Following this guide : https://www.prisma.io/blog/organize-your-prisma-schema-with-multi-file-support...
No description

problem when deploying prisma

hello guys , i just completed my portfolio and i'm trying to deploy my app to vercel but i'm always having this error You can mark the path "mock-aws-s3" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time. , the problem is i never used the path that he is talking about , i started getting the error when i ad...
Solution:
you are right , i found that there is a part of the project that uses Lucia auth i forgot to delete it , it's the source of this error

Can't reach database server at `aws-0-ap-south-1.pooler.supabase.com:5432`

DATABASE_URL="postgres://postgres.tdaudbkvlopqsbzesmau:[email protected]:6543/postgres" DIRECT_URL="postgres://postgres.tdaudbkvlopqsbzesmau:[email protected]:5432/postgres" Using supabase + prisma. ...

Prisma: command not found (Vercel)

I am confused whether I have completely misunderstood this, but how is it possible to integrate prisma with a vercel deployment? I have a postgress database in vercel set up, and I want to use prisma on top of that. Everywhere it says that it is possbile but I cannot get vercel to use a prisma command. I want it to prisma generate during build but all I get is prisma: command not found in the Vercel log. I have it as a dependency. Following the guide on the prisma website I have not gotten any luck, as well as AI and stack overflow....
Solution:
When reinstalling everything as a dependency in a new project it worked out. Dont know why the old project got ruined...

Vulnerabilities That Won't Be Fixed

Hi, when I was trying to run npm install prisma --save-dev I keep getting 15 vulnerabilities. And if I try to run npm audit fix --force, I still get the vulnerabilities.
Solution:
None of those packages are Prisma packages. I would reach out to those maintainers.
No description

problem when deploying

hello guys , i just completed my portfolio and i'm trying to deploy my app to vercel but i'm always having this error You can mark the path "mock-aws-s3" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time. , the problem is i never used the path that he is talking about , i started getting the error when i ad...

I can't disconnect a many-to-many relationship

Disconnecting the previous contact relationships is giving me a lot of headache. What's wrong with this statement? ``` → 16 update: ({ where, data }) => prismaModel.update({ where: { id: "80d02590-489c-4a76-80c8-dafb86c94f3f",...

using variable in queryRaw not working

Hi I have this code : `` const date = "2024-06-07" const regionCode = "US" const dateParam = [{"date": "${date}"}]`;...

make from model.prisma sql

Hello its possible to just get some method to do that too send model.prisma inside some function and get return sql? or send to models and get difference sql like alter? becouse we dont want to use prisma db push or prisma migrate and make our own flow to create tables

Help Needed with Nested CreateMany!

Hi everyone, I’m currently working on an API route to handle a POST request that does the following: 1. Accepts a single classroomId....

Question about designing friend request / follow system with relational tables

I'm using Prisma on top of PostgreSQL. In my app, I have a Follow table, denoting follow relationships, and a FollowRequest table, denoting pending follow requests. I've enforced that in both the Follow and FollowRequest table, the permutation of two users is unique. So we can't have multiple duplicate FollowRequests. I want to write a function for my expres s server that can reject a follow request. I have the user context already. I see two ways of writing it:...

Flat response from relational query?

I am trying to use the following Prisma query to get a post object back containing post details and the username of the user that posted it: `const posts = await prisma.post.findMany({ where: { users: {...

Server closed connection

Hi! My name is Abhi! I am running a Vercel application with Supabase on a medium sized instance. My connection limit is 3. Pool Timeout is 60. My Vercel max function duration is 300s Before this, I was receiving a huge amount of connection time outs. Now I am being plagued with Server closed the connection. ...

Adding fields to a templated `select`

Hi, Let's say I have a getUser function, which takes a select as its argument : ```typescript const getUser = async <T extends Prisma.UserSelect>(select: T) => {...

Multiple relations between the same Tables

I am trying to create the following relationship in my Prisma schema. I have two tables, Questions Answers ...

Conditional Unique Constraint

Django offers a conditinal uniqueness constraint: Is there anything like this in prisma? ``` UniqueConstraint( fields=['name', 'status'],...