Prisma

P

Prisma

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

Join

What's the correct way to fix this error?

I deleted my products table with almost 3 million records using DROP TABLE products CASCADE;. Then, when I tried to recreate the table with npx prisma migrate dev, Prisma raised these errors: ``` [-] Removed tables - products...

children and favourite child (ambiguous relation)

I want to model a relationship where a parent record can have many children but there is also a 'favourite' (or 'current favourite') child out of the list of children indicated by an id reference in the parent, to the child. I realise that this is a bit of a circular relationship and care will need to be taken when removing children or changing the favourite but I think the efficiency in query performance is worth the effort. Here is a contrived example... ``` model Parent { id Int @id @default(autoincrement()) ...

prisma migrate reset --force

Hi, I'm a prisma user. I am running prisma migrate reset --force to configure a test environment. However, even though I set the --force option, I am getting the following input window. Why? 'Are you sure you want to reset your database? All data will be lost.' (y/N)...

Need urgent support from Prisma team

Hi, Our production app on accelerate is breaking with an unknown error from Prisma, can someone from Prisma help asap? This is super critical for a new client launch today. Our DB is completely fine. We are unable to interpret the error as well {...

How to get the type of a compound query?

how would i get the type of this? ```ts const commentsPromise = prisma.urlComments.findMany({ where: {...

Support case insensitive advanced Json filtering

There is no support for case insensitive advanced JSON filtering on Prisma When we can expect Prisma to solve this, it would be a really good feature! ``` { applicantData :{...

How good is Prisma with Json fields?

I'm struggling to decide which DB to use with Prisma for Json objects? I will need to have filters for fields in Json object which looks like this, it has many fields... my questions are: is Prisma good for handling Json objects and would it be better to use MongoDB instead of Postgre? details: { attacking: {...

Prisma optimization

Hi everyone, i have a postgresql db with a table named Pricing, it contains arouned 35 columns (string and numbers), + and id, an enum and an index for the company_id related, without one to one relation For one specific company_id, it gives me around 1 milllions rows that i have to display on my frontend (100 per 100 with the pagination) My problem is that it lasts at least 1 min to display the data, it's too much, any idea how to improve the db ? ...

Timezone error

is anyone know how to solve the timezone error in sqlserver? when i query the data it will auto add 8 hour to datetime...

prisma aggregateRaw, how to parse Date back to javascript date, and other special types,

Unfortunately I've been forced to use aggregateRaw because I run into memory limits that requires the "{ allowDiskUse: true }". How can I either: 1) Add this option to regular queries or...

Deployment to vercel failing

I have accelerate activated, i can't deploy to vercel i always get this bug please help (im using mongodb/nextjs) this is my package.json ```json "scripts": { "dev": "next dev --turbo", "build": "next build", "start": "next start",...
No description

Using pulse in a next.js project

I have a next.js project that I deploy in lambdas serverlessly, I want to understand how I can implement in the best way pulse subscriptions in an application that's deployed in this manner

Add Model Extension methods

Hey so I'm using Prisma client extensions to add some methods to my instantiated database objects. However I find cases where either some external force strips the methods off the object or I need to. I would like to be able to reattach them. Is there a way to do this? Like run the model through a Prisma.applyExtensions(modelName, data)...

union type findMany

I want to be able to query in prisma using a variable which is a union type over mulitple model tables. so instead of ```ts const model : 'user' | 'post' | ...; const id : number = 1;...

How to cascade delete properly in a self-relation with mongodb ?

It is written in the doc that we need to set NoAction on self-relation database but how are we supposed to do it ? I tried getting all ids and using a deleteMany to delete parent and children together but I got a PrismaClientKnownRequestError. ```prisma...

[Typescript] Prisma result extension typing

How can I get proper typing in a prisma result extension for $allModels? For a simple example, I want to return the same type available in a Model.create for any model

will prisma support zod validations natively

I know there are plugins, but they all seem to be out of date and have issues with them not being always correct. I really wish this was natively integrated given how important this is to have. it just needs more cod gen in the generate function...

@unique on optional field

``` model Player { id String @id @default(auto()) @map("_id") @db.ObjectId steam_id String @unique ......

Why have "id" and "modelName" been left out of Pulse subscription event types?

export interface PulseCreateEvent<T> { created: T; action: "create"; } export interface PulseDeleteEvent<T> {...

Unknown argument xx. Available options are marked with ?.

Hi everyone, I have an error that I can't solve and I wanted to know if anyone sees an error in my model? I've been stuck on it for a while and I don't really understand why, even though everything seems right. IIt can either be linked to a Track or a Car (not both at the same time), which is why I've added the null option. ```js...