Prisma

P

Prisma

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

Join

@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...

Trying to get into Prisma; lots of hope and heartbreak

Hello! I've been trying to get into Prisma more and more because of the incredible promise and functionality it offers 99.9% of the time. However, I've unfortunately been experiencing some heartbreaking issues that just don't seem to make sense. I am running Node 18.13.0 compiled to js on my server and 20.10.0 pure ts on my pc. Both experience same issues....
No description

How to Implement an Optional One-to-One Relationship in Prisma with MongoDB?

Context I'm using Prisma 5.10.2 with MongoDB and attempting to set up an optional one-to-one relationship between two models based on the official Prisma documentation. However, I've encountered a problem with MongoDB's support for nullable unique fields. Models...

SOLVED: Create w/ sub create: Subquery returned more than 1 value

Per the documentation, I'm fairly certain I'm using this correctly. However, I'm getting the following error. We are on MSSQL and Prisma 5.11.0 `` "PrismaClientUnknownRequestError: Invalid prisma.testimonials.create()` invocation:...
No description

SQLite Timeout issues

I am having issues with Prisma + Sqlite. Essentially I believe Prisma isn't setting sqlite busy_timeout or something. There is a long history with this issue, see here ...

Returning the next day closest to NOW

So I have a list of dates, and im trying to return the next date that is closest to new Date.now(); Here is the code: ```ts const course = await db.course.findFirst({...

prisma nested fields

is it okay in terms of performance to have many nested fields in prisma? ``` const user = await prismadb.user.findUnique({ where: { id }, include: {...

Get the next date with prisma

```ts const course = await db.course.findFirst({ where: { slug: params.slug, },...

P3005 Error running Prisma migrate

I am working on a NextJS project that uses prisma. I was able to define my initial schemas and deploy my initial migrations successfully. I made a small change in the diff screenshot attached to this message and I am able to run npx run db push with no issues. When I try to run npx prisma migrate dev to generate a migration, I get the following error: ``` Error: P3005 ...
No description

i want a field to be an array in my mysql schema

I've created my model but in the image field I want it to be an array, so I can insert many images. Is there a solution? generator client { provider = "prisma-client-js" }...

Wierd type error with prisma codegen

29.01 qrtag:build: ./prisma/client/runtime/edge-esm.js:1:1
29.01 qrtag:build: Type error: Declaration emit for this file requires using private name 'i'. An explicit type annotation may unblock declaration emit.
29.01 qrtag:build: ./prisma/client/runtime/edge-esm.js:1:1
29.01 qrtag:build: Type error: Declaration emit for this file requires using private name 'i'. An explicit type annotation may unblock declaration emit.
...

why that not work?

Code: ```ts await prisma.pedOutfitFolder.upsert({ where: { userId: this.db.id, name: 'root' }, update: {},...
No description

Sorting by related field

Hey guys 🙂 I have a relation like: Ingredient(translation: IngredientTranslation[]) -> IngredientTranslation (name, langId.. ) (image 1) Is there a way to sort the ingredients by name? Since i get only _count on the translation field (img 2)...
No description

When to run migrations

Hi! I'm a bit unsure as to when is the best time to run database migrations when deploying new versions of an app, and would love to hear your opinions. Many suggest to run migrations as part of the deploy step during CI/CD, but my concern is that there'll be a window of time where to database has been updated, but the new code hasn't been deployed yet. How do people deal with this? Or do some of you run migrations before starting the web server instead?

Paying for this service but can't login. On multiple accounts now

As the title says. I keep running into these callback errors or whatever this is. I need to access my accelerate dashboard....
No description

Monorepo setup: Prisma with NestJS

I currently have a postgres database that uses row level security. This database is used by two services that are built with NestJS. - auth service - core service ...

Update nested field in composite types

I have a deeply nested structure. It has to be this way. I want to update a single field at the end of the nested tree structure. How do I accomplish this?...