Prisma

P

Prisma

The official Discord server of Prisma! Find us online at prisma.io

Join

Do i need accelerate for Mongodb?

Hey guys, just a quick q. Im using prisma accelerate for connection pooling and I do not make use of caching as the project im using it for does not need caching at all. Would it make sense to use Prisma orm without accelerate and pooling via the mongodb connection string?

Float datatype in MongoDB

I have this in my schema
balance Float @default(0)
balance Float @default(0)
I'm using MongoDB + prisma. How can I restrict the decimal place to 2 digits? ex: 2.12...

How to add a custom field on query result?

I have an implicit many-to-many relation: User and Post. A user could like many posts, and a post could be liked by many users. Here is the schema: ```typescript model User { id String @id @default(dbgenerated("uuid_generate_v4()")) @db.Uuid...

Optimistic Locking in prisma

There is any way to define that a field in database is the locking and automatically validate? Example: model User { id Int @id @default(autoincrement())...

There are easy way to use transaction in prisma?

I have the controller, service and repository and only the repository must have the prisma client implementation, but i need to use prisma service inside the service to initialize an transaction and pass to the repository the transaction instance... in spring boot i only need to add the @Transaction in the main service function and everthing inside is in transaction Service: await this.prisma.$transaction(...

How to run SQL query after each the migration

I have an enum enum AssignmentsEnum { DASHBOARD_READ REAL_TIME_READ...

PrismaClientInitializationError

Hey can anybody please help me out with this, i've tried rechecking the .env file, restarted servers, "stack overflow"d for hours...please do kindly help me out here.
No description

Everytime i make a small change in DB, i have to reset. I get this warning everytime.

`` - The migration 20240717073712_ was modified after it was applied. - The migration 20240722125612_init was modified after it was applied. - The migration 20240722131050_init was modified after it was applied. - The migration 20240722131821_init` was modified after it was applied....

Removing enum value fails on foreign key

I'm getting the below error when i try to remove an enum value from the database `` Error: P3006 Migration 20240731215417_drop_rqi_enum_val` failed to apply cleanly to the shadow database. ...

Using Prisma Client API with NextJS and a Private AWS Database backend

Our existing project uses an AWS Private IP RDS (MySql DB) on the backend and our frontend currently uses Next.js 14. We're fetching and patching data on the client side using API's As a frontend dev i'd like to be able to use server actions and take advantage of the Prisma Client API for using methods like user.findMany We use liquibase to manage DB schema, which means we wouldn't want Prisma to start updating the schema. Validating schema would be very useful though....

Why do i need a Prisma account for database subscriptions?

I wanted to use subscriptions for my application. I read that this can be achived with Pulse. But why exactly do I need the prisma cloud for that? In Prisma V1 subscribing to the database was possible without a cloud. https://www.prisma.io/blog/tutorial-building-a-realtime-graphql-server-with-subscriptions-2758cfc6d427...

struggle with conditional query

i have a query where i want to have a condtional filtering for userscores in a prediction but when i do so it dosnt have a effect on true or false. What am i doing wrong ? ```json { where: {...
Solution:
...(input.displayOnlyUnplayedPredictions && userscoreCondition),

Column order changing

We're using Prisma ORM with PlanetScale and we've noticed that Prisma will "randomly" change the order of the columns when we push schema updates. (See attached for an example) This is happening even though we haven't modified the schema model order. In this case, we added a unique index on a completely different model/table, and yet a different table has been "modified" to change the column order. Are we doing something wrong? If not, I can open an issue for further investigation....
No description

main.TableName Error

Hi noob question here, Do u have any idea why i'm getting this error. I compiled with webpack PrismaClientKnownRequestError: Invalid prisma.configuraciones.findMany() invocation: ...

Getting "internal error: entered unreachable code"

Hello, I currently have a PrismaDB database setup on my Raspberry Pi 4 running the standard Raspbian OS that it comes with, I have my weather station software running in Node.JS (TypeScript) and when it attempts to write to the database it recieves this: ```thread 'tokio-runtime-worker' panicked at libs/user-facing-errors/src/quaint.rs:167:18: internal error: entered unreachable code [30-07-2024 01:35:49 PM] error: ...

Triggering an Endpoint after the Cascade deletes the record of a model

i have a attachments model, where the images url are been stored that are been saved on the aws s3. If the attachment record gets deleted due to cascading. I want to trigger the endpoint to delete the image on that url also.
No description

Problem with $queryRaw (using Prisma.join) that doesn't return any result

Hi I would like to select items via WHERE IN condition, and I followed the documentation but no results are returned despite the fact that the ids exist in the table. ```js import { Prisma } from '@prisma/client' ...

How to test a prisma call that uses `connectOrCreate`? (using vitest ideally)

Hey all! I'm trying to write a unit test for the following prisma call in my Next.js app: ``` export async function createInterview(data: { participantIdentifier?: string;...

Upsert by Reference ID

Hello, I'm trying to upsert data by reference ID but Prisma reject this action Execution Code ```ts...

Help for Uncaught TypeError: Failed to resolve module specifier ".prisma/client/index-browser".

Hi All, I am from deployment team and our developer is using prisma orm in a project. Previous version of the project was using prisma version 4 and the developer upgrade it to version 5 in his last commit, now the application is facing this issue, Uncaught TypeError: Failed to resolve module specifier ".prisma/client/index-browser". Relative references must start with either "/", "./", or "../". The application is being built and deployed as a docker container. Currently the workaround has been done by making prisma version as 5 and @prisma/client version as 4.16.2. But we need to make it work for prisma 5.17 and @prisma/client 5.17.0. We are using RedwoodJs framework and node version 18.14. Can anyone please advise what steps needed to be followed so i can guide developer team to do the same. Thanks in advance....
No description