Prisma

P

Prisma

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

Join

What is the best way to use UUID v7 in postgres with Prisma?

Also is there a way to add PL/pgSql using Prisma schema?

Monorepo package isn't generating client

It was working for a bit in my monorepo, but i changed nothing and now only in builds it says types cant be found, despite no type errors in development

Remove the "?" in "user?.post"

Hey So this is from Youtube. When we get a user from prisma, it always has to include this "?" How can we make the code better so it wont require us to do that? Just to add if (!user) return XYZ; ?...
No description

Is it possible to subscribe to a creation of a model?

So I have a ticket model, and I want to execute an handler when a new model is being created, the thing is, if i subscribe to a middleware or $extend, I need to specify from where exactly i create that model, but the thing is, there are many options via nested queries to do that, e.g.: ``` model1: { create: { model2: {...

Prisma postgres with static IP - is this supported?

I was looking into using the prisma postgres instead of an Amazon RDS but I need to have a static IP so that I can connect directly to the database for my medussa.js ecommerce module which doesn't use prisma. Does anyone know if this is supported? It seems that the option for a static IP is not avaialble when I go through the steps to set up a prisma postgre database. Accelerate is installed by default without a static IP. If I go to the I have a database section I see this option.
No description

@map("updated_at") still shows updatedAt in prisma studio

Hey, So I did
updatedAt DateTime @updatedAt @map("updated_at")
updatedAt DateTime @updatedAt @map("updated_at")
...

How to update Prisma @unique

Hello, So I started a new NextJS project. I did this: ```ts model Post {...

Prisma not rolling back failed migration during vercel deployment

I've ran into a strange situation where during a deployment to vercel, I run the prisma generate && prisma migrate deploy as a build command. I had a migration fail during this. I went through, rolled it back, fixed it, then pushed the changes back to production. However, I noticed that prisma was not attempting to re-run the migration as it was marked as failed in the _prisma_migrations tables. I had to manually delete the migration entry for the migration to re apply correctly. My question is: Is there a correct process for re running failed migrations in production? I followed the instructions here https://www.prisma.io/docs/orm/prisma-migrate/workflows/patching-and-hotfixing#option-2-manually-complete-migration-and-resolve-as-applied. However it doesnt seem the migration was marked as rolled back. - Does rolled back have to be run in production OR can we run it locally and merge to production?...

Can't update table data from studio and directly

when I try to update the data in the table one particular model is not updated not through the api, not directly in prism studio. On the screen from the console the field phone = 1, The screen from the studio shows that the field is empty...
No description

Supabase Prisma Bad performance can't handle batches of saving on connection pooler.

I am unable to save lots of data at the same time using prisma and supabase. If i try to do bigger batches it always seems to throw these random errors that say the database cannot be reached. Is there some issue with the connection pooler or something I should know about?

Context : Shops and Orders. Autoincremented "number" by shopId

Hello, Let's say I've 2 entities in my schema. Shop and Order. ```ts...

Optimizing MongoDB Query for Unique User Count

How can I optimize my MongoDB query to count unique userIds for a specific action type (LOGIN_CLIENT) within a date range (startOfDayUTC to endOfDayUTC) without consuming too much time or resources? ```ts const monthlyUniqueIDs = (await this.prismaService.history.findMany({ where: {...

WILDCARD, New index type for MongoDB

I want to thank the Prisma team for the quick response to my previous request, especially @Nurul. My current question is: how do I add a new type of indexes for MongoDB, what is the flow for implementing this feature, where should I start, and what tests should I add? My question: https://github.com/prisma/prisma/discussions/26165#discussioncomment-12220940 Docs: https://www.mongodb.com/docs/manual/core/indexes/index-types/index-wildcard/...

real time fetching when data changes

I am using prisma postgresql and I need to add a trigger when something changes on the database I can fetch the data without prisma pulse.

Spend Limit

Hello there! I am not sure why but I can't set a monthly spend limit. Can you help me understand why? As you see in the screenshot, I am on the starter plan. Thanks!
No description

Error validating datasource `db`: the URL must contain a valid API key

My connection string: prisma://postgresql://username:[email protected]/stitchCounter?sslmode=require

Null constraint violation on the fields: (`ownerId`)

With the following schema when I try and create a new Project I get then Null constraint violation for field ownerId which doesn't exist anymore ```js model Project { id String @id @unique @default(cuid(2)) name String...

unique constraint failed on where column? how is possible?

In production, once in a while our customer gets an error on the backend """Invalid prisma.trainerProposalXrefDbo.update() invocation: Unique constraint failed on the fields: (id)""" on the following code """ `const promise1 = txClient.trainerProposalXrefDbo.update({...

NestJS + prisma optimize

I'm trying to add prisma optimize to project with nest.js framework. As I can see in logs - it initializes, but there is no data recorded ``` import { FactoryProvider,...

n:m relations between tables and view

I have a view "DepartmentInfo" as well as model "User". The user can be part of many departments and a department can have many users -- we are talking about n:m relation. ...