Prisma

P

Prisma

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

Join

Cursor based paging issue for multilevel relationships

I have this query. As you can see my paging field's like cursors are inside the select: works section. Question completes in the next post. ```typescript const works = await this.#client.follow.findMany({ select: { followed: {...

postgres db collation error

``` riginal error: ERROR: template database "template1" has a collation version mismatch DETAIL: The template database was created using collation version 2.39, but the operating system provides version 2.40. HINT: Rebuild all objects in the template database that use the default collation and run ALTER DATABASE template1 REFRESH COLLATION VERSION, or build PostgreSQL with the right library version....

Prisma (with MongoDB) sort based on their related field

Hi! How can I retrieve all users from the User model in Prisma (with MongoDB), and sort them based on their total points from the related ShadePoints model? I am currently using Prisma with MongoDB, What is the best way to sort users by the sum of their related ShadePoints.points using Prisma? Is there an example using or an alternative approach? model User {...

accessing prisma generated enums on browser client

in my prisma schema I have an enum called Sizes with the values of s, m, l, xl i can access that enum in on the server by importing import { Sizes } from "@prisma/client"; but whenever I import the same thing in a svelte file, the Sizes become undefined I temporarily fixed it by copying the values of the prisma generated Sizes...
Solution:
fixed this by passing the values of Sizes from server to client

Prisma SQLite

how to insert data inside the a table in prisma sqlite for internal table which are used only for linking and the data never get's changed

Supabase postgres not working sometime

So I'm working on a project using next.js and a simple CMS. Now I wanted to use supabase as a Backend for the project (bacause it has a free tier). To use postgres I decided to go with Prisma. But for some reason the project automatically disconnects from the supabase postgres. Sometime it works sometime it doesnt. Now I know that this is not enough information. So I tried to find the answer by changing passwords. Restarting supabase project, but it still showing the same stuff after sometime. I followed the official guide by supabase but the problem still exists....

Deploy to vercel with supabase as database

I am trying to deploy a Sveltekit app to Vercel using Supabase as my database and I am getting an error saying that I need to use an adapter for edge runtime:
Error: PrismaClient is not configured to run in Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware). In order to run Prisma Client on edge runtime, either:
- Use Prisma Accelerate: https://pris.ly/d/accelerate
- Use Driver Adapters: https://pris.ly/d/driver-adapters
Error: PrismaClient is not configured to run in Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware). In order to run Prisma Client on edge runtime, either:
- Use Prisma Accelerate: https://pris.ly/d/accelerate
- Use Driver Adapters: https://pris.ly/d/driver-adapters
But reading the docs I can't understand which adapter I should use for Supabase. Does anyone know how do I configure Prisma for supabase on Vercel?...

Start Prisma Studio Programatically

Is there any way to run Prisma Studio programatically? So that I can wrap it with Auth middleware and protect?

Turborepo with Prisma throwing Error

We are encountering an issue with our Next.js application using a Turborepo setup, integrated with Prisma ORM and Neon Postgres as the database. Upon invoking prisma.job.findFirst(), the following error is thrown: β¨― PrismaClientKnownRequestError: Invalid prisma.job.findFirst() invocation: ...

`prefer_socket` doesn't work when connect OceanBase with prisma

The same issue is posted on https://github.com/prisma/prisma/issues/24010 and I supply two solutions. However, it's like a stone dropped into the sea and no response at all. So I post it on Discord to look forward to receiving official support. Thanks for any help!...

Cant Connect into Prisma Pulse

Hello Support Team, This is my connection Link : postgres://<user>:<password>@vinayakvispute-100xdevs-vinayakvispute4-1688.g.aivencloud.com:12527/multi-resolution-transcoder-pipeline-mux?sslmode=require ...
No description

Get my data from render to local Postgres DB

I don't know if I should ask my question here but I have my database hosted on render and now I want to download my data and have a local database , I have a docker container with my backend and postgres with pgAdmin I tried downloading the backup database from render but restoring the db to local isn't straightforward, if anyone has experienced that before I would like to know the strategy 🫑...

Passing an array into TypedSQL query

Hi, thank you for the TypedSQL feature I am trying to use now, but getting an error when passing and array of integers. Can I ask for pointing out what am I doing wrong? This is my query in .sql file: ```...

Repo pattern

Hello, guys! I want toa ask about repo pattern with prisma. What to do if I have select: author, comments, tags, replys and etc into a single query. This will mean that my function name should be something like this getPostWithAuthorCommentsTagsReplys is there some best practice when dealing with such a case

npx Prisma init and Prisma init not working

Good day. Please advise. Today Prisma init stopped working, how can I solve this problem? Same with old projects. Prisma version 5.19.1.
No description

0% cache hits

I just setup accelerate and have verified it's working, but I keep getting 0% cache hit rate. How do I debug this? I think I am making the exact same query repeatedly

data optimization

Hello everyone, I'm really stuck and need help. I have a PostgreSQL database running with Docker on my VPS server. I was given a CSV file with over 60,000 rows, and my Next.js application is hosted on the same VPS. On my local machine, it works fine with no delay or timeout. However, after deploying, I noticed it was extremely slow. Most times, the requests time out because I'm trying to fetch all the data to create a dashboard. I think the problem might be related to how I'm making the database calls. I would be really grateful if someone could hop on a call or review my code to see what I can change to improve performance. here is the github link https://github.com/alidauda/Analysis-...

createManyAndReturn order preservation?

do we know if the order of the created entities in the returned list is the same as the input list? couldn't find anything in the docs!...

New Prisma 5.19 TypeSQL: other statements beyond select

Greetings The TypeSQL support an insert statement like this? (Assuming PostGIS was installed). INSERT INTO locations (name, geom)...

Prisma Types

Pls somebody help with these types ```js type PostFindUniqueResult = Prisma.Result< typeof db.post,...