Prisma

P

Prisma

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

Join

How to setup Next js apps on Vercel using Prisma....

I've been fighting bugs for ages, Mye learning journey is stuck for months just because i couldn't find a way to deploy my next js app on vercel that uses Prisma and MongoDB, I really have a question How to deploy on vercel with my prisma powered next app? Can I use accelerate on vercel? here are my files and how I use them: ```ts...

How to create a .prisma file for each Model in a schema

i looked around to find package that does this but no luck , or at least it was not exactly what i was looking for , i found shemix however i just don't really like it i much prefer the prisma syntax rather than writing js to then be converted to prisma , what i'm looking for is a way to have each model in a prisma schema in it file kinda like graphql typedefs importing relations and stuff like that.

Prisma ORM with Cloudflare D1/Next-on-pages

I'm transitioning my app from planetscale/prisma -> D1/Drizzle -> Cloudflare D1/prisma. Trying to set up a 'db.ts' folder which can be callable into different portions of the app to query the db. Anybody have experience setting this up? Doesn't help that there are only two examples in existence, both of which query D1 through a worker (rather than directly from the app). This is my current code: const adapter = new PrismaD1( process.env.NODE_ENV === "development"...

A bug with prisma

Whenever I try to make a new instance, i get this error
No description

Is it possible to use every + and?

Here is what I am trying to do: I have two tables "user" and "tags" I want to find all the users that have the tags 'a', 'b', 'c', if one of them doesn't exist, don't return the user. ChatGPT says it's not possible 😇...

Incorrect binary data format in bind parameter

This is my problem, it's happening more and more now randomly and causing me problems: https://github.com/prisma/prisma/issues/17110#issuecomment-1881993283 Posted about it 4mo ago, janpio 👀 'd it, not sure what else to do here. Hard to reproduce but it's happening for me multiple times a day now....

Prisma not recognizing Date-only values

I have a DateTime field with @db.Date annotation, but it still expects me to pass a full ISO 8601 date+time string. The model: ``` model Usuario {...

Dynamically changing DB connection during runtime

Hey y'all! Been looking far and wide and hoping someone has suggestions. Currently trying to figure out how to dynamically change a Prisma connection to a new database. We currently have about 800+ databases that all have the same schema, but need to be able to change databases based on certain params. So like our current Rails API setup is using the built in sharding that came from Octopus. We check a header value from the request and then change the database connection from that value. I'm hoping to achieve something similar where we use some type of hook, grab a value, and then adjust the Prisma connection accordingly....

How to Handle Case Insensitivity?

This is giving me an error with findFirst.

Inconsistent query result: Field topics is required to return data, got `null` instead.

All data exists in the db but this still happens. ``` where: {id}, include: {...

Does Prisma Studio work without Node (i.e. with Bun)

I've got an environment where Node is not installed. I'm currently running the entire project with Bun, and so far I've avoided issues with db push, generate and the Prisma Client. Although, when I try to run bunx --bun prisma studio it crashes on server startup with the following error: ``` TypeError: Process was closed while trying to send message at #disconnect (node:child_process:774:27)...

How to run safe migrations

hello guys I am new to Backend. i am using prisma. and I have a hairstyle table containing hairstyles and now I added a business to the hairstyle table that references the business table. now I want to run migration but it’s giving me an error that the previous hairstyles in my database references null businesses. how do i solve this...

Prisma Warn Console in development

I have encountered the following warning message: prisma:warn. Despite searching extensively in the documentation, I have been unable to find a resolution The error message appears as follows: prisma:warn In production, we recommend using prisma generate --no-engine (See: prisma generate --help) but i see this message only in Development...
Solution:
Hi :vmathi: Have you tried to simply run prisma generate --no-engine as suggested?

Type 'string[]' is not assignable to type 'string'.ts(2322) when trying to create a form using Prism

so I'm trying to create a submitForm using prisma, react-hook-form and zod and mysql as my database. But the problem I'm encountering right now is I get this error on form-submit.ts Type 'string[]' is not assignable to type 'string'.ts(2322) I know this comes from my schema.prisma, because upon reading the docs, on Scalar https://www.prisma.io/docs/orm/reference/prisma-schema-reference#-modifier ...

Strange @relation fields in auto-generated models

Using prisma@5.13.0, I ran npx prisma db pull to generate models for an existing SQLite database. It generated these models: ``` model chapters {...

I feel this is simple but I fear i've just been at it too long I'm starting to not see straight.

I have a parent record with a many to many relationship with a child, such as: ```js model User {...

findMany query is failing as it's breaching planetscale's 100k limit but rawquery is working fine

Is findMany fetch all records before it applies distinct condition? await prisma.table.findMany({ distinct: ['field'] })...

Pulse listening to all schemas in my RDS instance

I want pulse to only subscribe to changes within one schema but it gives me changes of all schema, is it intended? how do I fix it?

How to avoid resetting the DB when switching between branches with schema diffs

Hello, We are a small team of 4 working with prisma every day, and we often have to switch to the branch of a coworker to review their work. But doing so, we need to reset the DB to migrate their version of the schema if they made change to it (while we also made some changes on our end while working). ...

Connecting prisma with mongodb issue

Hello, been following docs, used nextjs and i get this error.