Prisma

P

Prisma

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

Join

Raw SQL generated for cursor using libsql issue

To start with I am using: ``` "@libsql/client": "0.6.1", "@prisma/adapter-libsql": "5.14.0", "@prisma/client": "5.14.0",...
Solution:
Alright, so I figured out the issue is coming from "You must sort by your cursor, which has to be a unique, sequential column."

prisma.transaction.findMany() not working

i have a transactions table in my database and transaction model. when i use prisma.transaction.findMany() it not working.

Cleaning code

So, just building a basic scoreboard side project, which I need teams and scores for it. Is there any ways to clean up these models? They just seem kinda clunky to me, dunno if I'm the problem here. ```proto model Team {...

How to push changes to already deployed db?

I have an already deployed db on cockroach db and I have added the index for one filed in atable schema. Now I want to push the changes so that index is added. How can I do this. I read the docs and it said not to use the push for production environment....

check connection - prisma nextjs

How can I check prisma connection before querying using await prisma.user.findMany() I have the client, but need to check if it was able to connect to my postgres database before i try to query, else i get error if not able to connect to database...

Lock tables

I want to lock write mode of a table before executing a prisma query. How I can achieve this. Please help me

500 (Internal Server Error) from simple query

I am running the following query: ``` import { unstable_noStore as noStore } from "next/cache"; import { NextResponse } from "next/server"; import { prisma } from "@/db/client";...
No description

[Help]Prisma ORM with Express and TypeScript. Trying to use include.

I'm using Prisma ORM with Express and TypeScript and I'm trying to use include with findMany query. I'm currently getting a typescript error. `export const getAllCategories = async (req: Request, res: Response) => { const categories = await prisma.category.findMany({ include: { products: true }, });...
Solution:
Hi @Samar 👋 You have a typo in your Category model. You defined a field procucts instead of products. Can you update the field and then regenerate the Prisma Client by running npx prisma generate....

prisma use middleware

Hi I am trying to collect logs for args before query request. However, in case of USE (middleware), it is checked as deprecated, is it possible that the feature will be removed in future updates? If so, I was wondering where I can collect ARGS logs for all query requests as an alternative to the middleware....

Prisma telemetry operation contains unaccounted for time

Hi there! I'm looking for a little help understanding something I'm seeing frequently from opentelmetry traces in my application. https://www.prisma.io/docs/orm/prisma-client/observability-and-logging/opentelemetry-tracing#trace-output I'm seeing many prisma:client:operation spans with unaccounted for time in the operation itself. I see serialization, the db query itself, and deserialization, but then there's over 600ms of unaccounted for time remaining in the operation. Where could this be coming from? Is it possible to get more detail out of this? I've attached a sample tree of spans in my trace that illustrates. ...

Prisma ORM returns two different results from two similar (?) queries

Hi everyone ! Could someone help me figure out why this two queries don't return the same result ? As I understand, the values given to is_deleted, type and inserted should be mandatory for both queries, but it seems that only the second one, with the duplicated common fields in both OR 'branches', give me the correct result. ```ts...

UncheckedCreateInput error when trying to create a many to many relationship (likeSermon / likePost)

Hello i get the following error when i try to creating a relationship where users can like sermons. Pleas i need help in rectifying this. Type '{ sermonId: string; userId: string | undefined; }' is not assignable to type '(Without<LikedSermonCreateInput, LikedSermonUncheckedCreateInput> & LikedSermonUncheckedCreateInput) | (Without<...> & LikedSermonCreateInput)'. Types of property 'userId' are incompatible. Type 'string | undefined' is not assignable to type 'string'....
No description

Implicite Many-to-Many relationship double primary key

Implicite Many-to-Many relationship with two models, but one of these two models has a double primary key?
Solution:
Here is an example of how you can define an explicit many-to-many relation based off of your example ``` model Kit { kitid Int @id @default(autoincrement()) kitname String...

mongodb connection randomly unable to connect

https://github.com/prisma/prisma/discussions/11929#discussioncomment-9600119 Error: MongoDB error Server selection timeout: No available servers. Topology: { Type: ReplicaSetNoPrimary, Servers: ...

Prisma client doesn't get updated with new columns after db pull

As you can see in the screenshot, there is a user_auth_token in the schema that showed up after I prisma db pull. I then use prisma generate to regenerate the prisma client but I still can't update this field.
Solution:
Hi @Kawthar That's actually strange. Can you try restarting your tpescript server in VScode or restarting the IDE?...
No description

npx prisma migrate dev --name init from tutorial not working

Once I get to the part in the supabase prisma tutorial where I run the command npx prisma migrate dev --name init the terminal gets stuck at: ``` Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": PostgreSQL database "postgres", schema "public" at "aws-0-us-west-1.pooler.supabase.com:6543"...
Solution:
Hey @Nurul that solution works! So does this mean I won't be using the connection pooler?

Error Initializing Prisma on Expo

I've created an Expo project which I am trying to connect to Supabase via Prisma, but I get the following error after bundling on my physical device: ``` ERROR Error: 🟥 @prisma/react-native failed to initialize, js engine: hermes at ContextNavigator (http://10.0.0.213:8081/node_modules%5Cexpo-router%5Centry.bundle//&platform=ios&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:144849:24)...

Does Accelerate support MSSQL?

Does Prisma Accelerate support MSSQL? I don't know if I set it up right, but I ge the following error, when I try to configure MSSQL in accelerate and then setup the client/edge in my application:
Unknown server error: {"type":"UnknownJsonError","body":{"code":"P6000","message":"Something went wrong."}} (The request id was: 88b049569d096dc7)
Unknown server error: {"type":"UnknownJsonError","body":{"code":"P6000","message":"Something went wrong."}} (The request id was: 88b049569d096dc7)
...

[FIXED] Error when providing certificate

I'm passing the certificate in the url, but it doesn't work. My project tree is this: ``` ├── src...
Solution:
I added the file to the NestJS CLI assets configuration and decided to test the full path in the dist folder (sslcert=/app/dist/infra/db/prisma/cert/global-bundle.pem) and it worked.

dmmf in prisma 5

I'm loading a prisma model metadata like this in prisma 4: let currentModel = Prisma.dmmf.datamodel.models.find(m => m.name === model) It seems Prisma.dmmf is undefined in prisma 5. I need it in filter string parsing, to find out whether a certain field is a list, so that I can nest it within "some" prisma filter construct. Any suggestions as to what I can use in prisma 5 to achieve the same?...