Prisma

P

Prisma

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

Join

Is there actually a best practice when it comes to naming conventions?

Yes, I've read the docs but found the weren't particularly explicit in what best practice actually is. What I've been able to deduce is the following: 1. It's best practice to use PascalCase for Prisma model names 2. It's best practice to use camelCase for Prisma column names...

Debugging Invalid `prisma.$queryRaw()` invocation

I am getting an Invalid prisma.$queryRaw() invocation error when running my code in the cloud (specifically trigger.dev). I have a fairly distinct setup in that I have multiple packages abstracting different Prisma schemas in my monorepo. They are all getting bundled together for Trigger with some bespoke code to copy the binary combined with the prisma extension. Example snippet from the schemas, which are all configured roughly the same way. ``` datasource db {...

`prisma-client` generator in compiled workspace package

Running into this error:
The inferred type of 'foo' cannot be named without a reference to '../../../node_modules/@mrb/mysql/dist/generated/internal/prismaNamespace'. This is likely not portable. A type annotation is necessary.
The inferred type of 'foo' cannot be named without a reference to '../../../node_modules/@mrb/mysql/dist/generated/internal/prismaNamespace'. This is likely not portable. A type annotation is necessary.
I know you can get rid of th error by setting declaration to false, but that is not an option for me. What is the best way to go about this?...

Generic parameter in function for includes

```ts export const getVoiceChannelSession = async <T extends true>( includeBans: T ): Promise< | Prisma.VoiceChannelSessionsGetPayload<{...

error requesting Query Engine from pool

Suddenly have this error taking my app offline `` Error: Invalid prisma.memories.findMany()` invocation: ...

Transaction operations are not executing sequentially when using PrismaPlanetScale adapter

I've been working on upgrading our Prisma to v6 and leveraging some of the new features like driver adapters, specifically the PrismaPlanetScale adapter. After starting to use the PrismaPlanetScale adapter, I am getting an error when trying to execute multiple related operations in a transaction. For example, the following transaction errors: ``` await prisma.$transaction([ prisma.user.create({ data: { id, ... } }), prisma.user.update({ where: { id }, data: { ... } })...

Randomly Getting introspect operation failed Prisma accelerate

please i need help. this just came up this evening. been trying to find a fix
No description

Migration fails with CockroachDB

I use CockroachDB as the database for my app and prisma as the ORM. Running npx prisma migrate dev always fails for whatever reason, but npx prisma db push succeeds. Is there a reason why this behaves like this?

Prisma Files too large to upload

The prisma generated files are almost 46M+ in node_modules. However after bundling, it becomes 20M. According to open-next documentation, we have to add @prisma/client in next.config.ts. But due to the large size of prisma it fails to upload to cloudflare workers. (I ensured it by adding and removing @prisma/client from next.config.ts). Any suggestion to reduce the size of prisma generated files? I am using a driverAdapter and a neon database

[tRPC] server app cannot find prisma folder as it's in trpc package

My turborepo is split up in trpc package for 1. server to use prisma queries and for 2. client to use type of trpc routers. As prisma calls are made in routes, prisma folder is generated for trpc package and Prisma Schema is there too, not server app. Prisma looks for prisma folder under app/server and fails. ```ts // packages/trpc/schema.prisma generator client { provider = "prisma-client-js"...

Could you help me analyze this time zone issue?

Environment: Prisma 6.11 / Mysql 8.0 1. Does Prisma support setting the time zone in the connection parameters? My actual local time zone is UTC+8 (Beijing, China). The following picture shows the result of querying the time zone of my MySQL server. Note: It should be noted that the time zone shown in the picture is the time zone obtained by directly connecting to the database and querying using a database connection tool. Therefore, the time zone of this session and the MySQL server is "system", representing the Beijing time zone....
No description

Getting Connection closed. randomly

We have been using Vercel/Next.js/Prisma for a bit and in one specific spot we have prisma.salesOrder.findMany() including a bunch of other tables (not ideal I know). When we use order by in this operation, we get "Connection closed.". Things I have done so far: - Changing the connection string from connect_timeout=15&connection_limit=20&pool_timeout=60 to connect_timeout=60&connection_limit=30&pool_timeout=0...

How can i avoid have to explicitly type out return types, can i use generics somehow?

How can i avoid have to explicitly type out return types, can i use generics somehow? ``` import { Prisma } from "@composabl/database"; import { IClusterRepository } from "../repository";...

Incorrect type being returned from getQueryMethod

``` type ModelName = Prisma.ModelName; type ModelDelegate<N extends ModelName> = PrismaClient[Uncapitalize<N>]; export function getQueryMethod<T extends ModelDelegate<ModelName>>(model: T, single: boolean = false) {...

How to properly type return and include types for my function

import { Prisma, PrismaClient } from '@composabl/database'; type ModelName = Prisma.ModelName; type ModelDelegate<N extends ModelName> = PrismaClient[Uncapitalize<N>]; ...

Not sure what types to use to correctly restrict my generics

I am looking to do something like this wthe criteria and options arguments so they are restricted depending on the model i pass in. The current types are not real. ``` export interface QueryOptions<TOrderBy> { single?: boolean; take?: number;...

Ugly logs

When prisma logs an error, I seem to get the whole generated client bundle logged. Is there something I'm doing wrong here or an easy fix? I'

prisma.ts path generation

Hi I using @prisma/nuxt package and each time I run pnpm run dev it generates the prisma.ts file in a lib folder. There is a way to change the path of this file generation please? Cheers!...

PrismaClientInitializationError on vercel

Error [PrismaClientInitializationError]: Invalid prisma.user.findFirst() invocation: Prisma Client could not locate the Query Engine for runtime "rhel-openssl-3.0.x"....

Cannot find module '@prisma/client/runtime/query_compiler_bg.mysql.wasm on vercel

As above, using the query compiler, now my project cannot find the WASM File. before, it couldnt find the binary. This only happens on vercel, it's fine locally, and it's also fine on an EC2