Prisma

P

Prisma

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

Join

Logging client errors

Why the following code does not work? The create statement throws a Prisma.PrismaClientKnownRequestError with code P2002 (unique constraint violation). I don't need specific error handling (https://www.prisma.io/docs/orm/prisma-client/debugging-and-troubleshooting/handling-exceptions-and-errors), just a raw console.log of the error....
No description

Prisma Studio ➖ Getting no records in T3 Stack

(dot)env with:
DATABASE_URL="postgresql://postgres:mysecretpassword@localhost:5432/databaseName?schema=public"
DATABASE_URL="postgresql://postgres:mysecretpassword@localhost:5432/databaseName?schema=public"
When typing the following: ```pnpm prisma studio...

Prisma examples - I ran through the ORM Fullstack examples and have some feedback:

overall: * no need to run npm install as that is done already ✓ Should we automatically install packages for you? Yes * the default directory name starts with orm_...

Connecting to docker postgres database

When running the command npx prisma db pull ``` ✔ ~/Project_Development/carspectra [main L|● 1✚ 2] 05:25 $ npx prisma db pull Prisma schema loaded from prisma/schema.prisma...

Prisma Mongodb & Express Res API Docker

Hi I am tryin to create a docker compose that ecompasses A Rest API in Prisma and Express.js and a MongoDB Database. I am using this docker-compose file: name: 'proofifi-project' services: mongo:...

Programatic where clause based off query parameters.

I'm using fastify although I doubt that matters. Attached is pseudoish code. I am looking for a way to programmatically add to the where clause based off query parameters. If there are no query parameters, just do a select * from {table} I have searched the documentation pretty well, and searched blog entries etc, couldn't find an answer:...

Soft Delete with Nestjs

Hi everyone How I can implement soft deletes using Prisma and Nestjs? I found on the docs but is using middlewares, and for what I know, they are deprecated. Thanks for your time...

How to deploy to a self-hosted server?

At the moment I'm hosting my website on github pages, but I've kinda outgrown github pages now that my site needs a database. I have a spare machine lying around, so I'm trying to host my website off of it instead. Ideally I want to add some kind of a CI to automatically keep my site up-to-date whenever I push to github (and I think self hosted actions runners are the way to do this?) but I don't know how this would tie into prisma at all? I'm also super unsure if my project is set up right because I've gitignore'd the everything in the prisma folder except the schema I've got near-zero experience doing anything like this so please be patient with me!!...

Is there a way to generate model in prisma using cli?

I'm developing a white-label solution based on CLI inputs, and I'm wondering if there's an extension or tool that can assist with filling out a form using types and relations, which would then be automatically generated in the schema.prisma file.
Solution:
Hi Rev 👋 I am not aware of any CLI tool to automatically generate schema file. There are other tools like https://prismaliser.app/ and https://prisma-editor.vercel.app/ which you may want to have a look at...

PrismaClientKnownRequestError: Invalid prisma.b2bTransaction.findUnique()

prisma table B2bTransaction exists in database cross-checked with the studio, but when try to use in hono on production, it gives this error:
PrismaClientKnownRequestError: Invalid prisma.b2bTransaction.findUnique() invocation: The table public.B2bTransaction does not exist in the current database.
PrismaClientKnownRequestError: Invalid prisma.b2bTransaction.findUnique() invocation: The table public.B2bTransaction does not exist in the current database.
...

Minecraft command block texture problem

I'm new to prisma 3D and i want to make a Minecraft animation with the wither storm and i couldn't figure out how to add textures and for awhile i figured out how to add textures but the problem is that it looks like this
No description

Production Migrations after Dev Migrations

Hello, I push my project to a GitHub repo, and I did an initial migration from my dev database and then did migrations after that. I had already hosted my app on Vercel though. My question, is how can I go about creating an initial migration for my production code if I already pushed my dev migrations to the GitHub repository that is then sent to Vercel? I think my dev migrations are in the repo the prod is using, so when I run the init prisma migration, the code throws an error. ...

Error: MongoDB error: An error occurred during DNS resolution: proto error: io error: A socket opera

https://github.com/prisma/prisma/discussions/14908 I found some solution online but this all doesn't work for me. Is there any other solution you can suggest? PrismaClientInitializationError:...

Error validating datasource `db`: the URL must start with the protocol `prisma://`

Hey, I've just tried to deploy my Node-Project to a Coolify Instance, but now I'll get the above error. I have set the DATABASE_URL in the environment variables to this: postgresql://postgres:pass@ip:5432/postgres what could be the problem there? before, it worked fine....

cloudflare pages + Prisma

Hi I'm trying to build a Next.js Full stack application with Cloudflare pages thus can you please share steps to configure the Prisma along with Postgres in cloudflare next on pages I had referred this documentation https://www.prisma.io/docs/orm/prisma-client/deployment/edge/deploy-to-cloudflare but was unable to understand the exact steps to be taken Thus please try to help me with this...

Help with `[optimize] HTTP 409 Conflict: There is no active recording to write queries to.`

I have a NextJS 14 site running in local development. However, I run it using next dev -p 3002 --experimental-https as I need SSL for local testing. I have a very straightforward Prisma setup. ```...

relation-queries-docs

Hi, I'm new, and I think I'm misunderstanding something in the docs, on this page: https://www.prisma.io/docs/orm/prisma-client/queries/relation-queries#filter-a-list-of-relations It states, "... the following query returns all users and a list of titles of the unpublished posts associated with each user:" ```...

How prisma handle with n+1 problem using relation strategy query instead of join?

My question is prisma handle the queries to handle the n+1 problem?

Use foreign key as primary key

I've implemented multi-table inheritance following your guide: https://www.prisma.io/docs/orm/prisma-schema/data-model/table-inheritance#multi-table-inheritance-mti My question: Is it possible to merge the foreign key and primary key on my child table? It's easier to query if the parent table (User) and child table (Admin) have the same id. But duplicating the ID is not great because it introduces room for mistakes. I tried it earlier and got an error....

How do I connect to mysql on host from inside a docker container?

things I've done: - I changed the bind-address to 0.0.0.0 so mysql would allow connetions from the docker network instead of limiting itself to 127.0.0.1 - To my docker-compose.yml, I added ```extra_hosts:...