Prisma

P

Prisma

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

Join

Convert Raw Query back to prisma type

Is there any utility function to convert the result of a raw query back to prisma types? ```{ _id: { '$oid': '6587f42a8aad36c44d06e712' }, type: 'Feature',...

When db is updated how to get that alter into prisma?

Hello- I am new to prisma & wondering any good resources or tutorials about moving structure down from the database or up from the schema? Also if the database is altered slightly such as adding a column to a table; how can we update our prisma in our app? I understand that if we update the schema.prisma file with adding a column we can then run a "prisma migrate dev" & it will alter the db but how can we do the same but if there is an update in the DB & we want to update our code? ...

[Prisma] Nested create with 2 levels of related records

Say I have an object: ```js const params = { name: 'bob', age: '25',...

[Neon] [Driver Adapters] Do we need DIRECT_URL if using Driver Adapters?

So I have been migrating Planetscale DB to Neon and I was wondering if we need to provide DIRECT_URL for migrations when using Diriver Adapters? I could not find that information here: https://www.prisma.io/docs/orm/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm-preview I am checking "Pooled connection" check box when procuring the connection string. Based on this, https://www.prisma.io/docs/orm/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm-preview, when we needed to use pooling with PgBouncer, we needed to provide DIRECT_URL....

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 [email protected], 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 {...