Prisma

P

Prisma

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

Join

Typed sql only certain parts of query

Hi there, just wondering if there is an issue in place already for a feature to allow escape hatching only certain parts of a query? In my case I would like to escape the orderBy part of the query and keep Prisma ORM everywhere else. Thanks

Create tables for local development

Hi! I'm trying to use a local instance of a PostgreSQL database (via Docker) so that I can make queries without hitting my production database. I'll need to create the tables themselves inside the database before I can make these queries. Is there a way I can do that from what Prisma generates? I have the Prisma schema and the associated models (e.g. User, Session, Account), but I would need to translate it to raw SQL statements and add them via a Docker initialization script. I know there are already raw SQL files for the migrations, but those are "step by step" rather than the final / most up to date results. I could do this by hand, but this means that any time I update the schema, I would have to manually edit the initialization script as well (which would be prone to error). Thanks!...

I need to register the popularity of products

I'm creating a site where I need to create some "product history" but also register the popularity so people can sort the product list. If I register each visit I'll be registering bots or crawlers visits. How did you achieve this in your app? google analytics?...

TypeError: client_1.Prisma.validator is not a function

I set up a nx monorepo application with nest js prisma and I have this error when I run a generated docker image for my nest js app. ``` 2024-12-01 19:03:38 /app/api/main.js:283 2024-12-01 19:03:38 exports.transactionWithRelations = client_1.Prisma.validator()({...

New to Prisma, can I not rely on the order of the array when creating nested records?

So referencing organiser.events[0] doesn't seem to refer to Event 1? ``` const organiser = await prisma.organiser.create({ data: {...

Optimize recording does not record any query

I start the recording, I interact with the app, all queries function correctly and are logged to console, but nothing shows up in the recording, I have already tried: - removing the settings and the $on callback - reassigning the client with the result of $extend...

Prisma Client could not locate the Query Engine for my runtime on AWS

guys im deploying prisma to a lambda on AWS with arch="arm_64" in my prisma schema i have this: ```ts generator client {...

Working with decimal in NextJS

Has anyone found a reasonable way to work with Decimal in NextJS? "Only plain objects can be passed to Client Components from Server Components. Decimal objects are not supported." Every time we add a Decimal to our schema, we end up breaking a bunch of server components. The only option seems to be manually serializing and deserializing everything, which isn't great....

Error The "payload" argument must be of type object. Received null

Hello, I keep getting this error with Next.js 15 Postgre SQL and Prisma. I'm confused on if it's a Prisma bug or something else? I'm checking my object before performing any mutation, and it's not null. ...

How to use Pulse with Next.js

I’m trynna figure out what’s the best approach to use Prisma pulse with Next.js (app router), so I came up with this but im not sure if this is the right way to do it ```jsx async function setupAllPostsSubscription() { const subscription = await prisma.post.subscribe()...

`isNot: null` filter on relation does not work

As you see in the image i use the not null filter in order to return routes that are assign to both regions. Currently all routes do not have a region. But the console log returns null for the relation. ...
No description

Database connection dropping

I have a postgres sql db on GCP with a connection string. i have set up publications on this table using sql commands from the docs. for some reason, pulse keeps dropping the connection. I see "Unexpected Error Occured" on the console and a DIsconnected status for Database connection ...

How to run migrations with SET ROLE xxx

Hi everyone, I’m working on a project where I need to run Prisma migrations, but the database connection requires a specific role to be set before executing any SQL commands. For example, I need to run: SET ROLE some_table ...

Prisma Studio crashes with large databases

I have the following model: ```prisma model GTFSImport { id Int @id @default(autoincrement())...
No description

Weak relations

Hi there, Is there any way to use Prisma relations without any foreign key constraint on Postgre? I'd like to be able to set this up on a per table basis and not for the whole database like relationMode = "prisma" would do. I've been looking online for this and it appears to be a feature that has been requested a couple years ago already. What's the status on this?...

Prisma.join throwing error when using edge client

prisma : 5.22.0 @prisma/client : 5.22.0 Node.js : v23.1.0 Next.JS : v15.0.3 ...
Solution:
Hi @Papa Smerf The edge client is a stripped down version and may not support the Prisma.join() api. Rewriting the raw query without using Prisma.join() should resolve this issue. `` await prisma.$queryRaw...

creation of new user failed and exited an error in vercel logs for my project

In the creation of new users I made use of better auth for authentication and the creation of a new user in my nextjs project which I integrated with prisma as my ORM with supabase as my database............. this arrangement however performs the creation of the new user in development however after deploying to vercel and performing the same authentication of new users it throws this error which indicates that the new user cannot be created and i don't seem to know why it doesn't work in deployment where i have added the environemt variables required by prisma like the DATABASE_URL and the DIRECT_URL needed by prisma to connect to my supabase database and this connnection worked fine The error from vercel logs upon creation of new users: [Better Auth] ERROR ...

Using OR in connectOrCreate

I want to connect to an image if imageId is defined. If not, I want to connect to an image with a matching fileStorageObjectId. If it is not found I want to create a new image. ```js featuredImage: { delete: true,...

Failed requests

After enabling detailed logging on the Prisma Client instance, I've noticed quite a few failed query attemps. ``` prisma:warn Attempt 1/3 failed for querying: This request must be retried prisma:warn Retrying after 26ms...