Prisma

P

Prisma

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

Join

Optimize not showing any queries

For some reason when I click on record it won't show any queries done but the accelerate works. (pnpm dev) ```ts import { PrismaClient } from '@prisma/client/edge' import { withOptimize } from '@prisma/extension-optimize'...

prisma validation

what's the best approach for validating data before creation if prisma currently can't validate nested writes?

Easiest way to investigate a slow Prisma D1 query?

I have an instance of Prisma that I'm using to run a query. The code consistently takes 200 - 250ms to run. On the D1 dashboard the query time is 0.4ms. I would like to understand where that extra time is coming from (serializing the result, waiting on the d1 api, etc) ...
Solution:
ah, I found the issue. Each query is taking 70ms and prisma is generating 3 queries and sending them in series! https://github.com/prisma/prisma/issues/23348...

Custom Migrations

What's the recommended way to customize migrations that aren't supported by Prisma Schema directly? More specifically, if I wanted to add Partial Indexes, Collations, Computed fields, etc..., I recognize we'd likely need to update the generated migration file. That ends up defeating the purpose of Prisma Schema (a snapshot of your DB schema) as there is info not represented. Are comments the only solution here or is there some (undocumented) way to develop custom annotations that affect the migration?...

Auto orderBy

Is there a way to auto orderBy in Prisma without having to do it in every query?

vercel Prisma Client could not locate the Query Engine

Hey, I'm currently trying to deploy the development version of my website on vercel and I have started getting this error after updating to version 6.4.1 (previously was on 5.4). ```ts Prisma Client could not locate the Query Engine for runtime "rhel-openssl-3.0.x"....

how to prevent duplicate rows in my friends table

i am working on adding friends feature in my application i am using mysql database , with prisma orm i have a friends table and a users table as the name implies the user table stores the users , friends stores friend records the schema of both tables are as follows ```model Users { id
username
email ...

Prisma Postgres Using psycopg2

Hello everyone, I urgently need assistance with an implementation issue. As a beginner working with Prisma and PostgreSQL, I am currently experimenting with various approaches. I am unclear whether it is possible to integrate Prisma with the psycopg2 Python library for interacting with a PostgreSQL database hosted on Prisma Postgres. Could someone please provide guidance or point me toward relevant documentation? Thank you for your help....

Custom user type vs database type

I usually use the Prisma generated types throughout my app. But in my current project, I'm getting into problems. Example: Since it's a multi-tenant app, a user can belong to multiple organizations:...

CUID Not Auto-Generating

I'm trying to write a seed script to populate my database with mock data, but for whatever reason, I'm getting a null constraint error for the primary key ('_id'), even though my schema is set to autogenerate this. It generates them just fine within my actual app, but it's not for my seed script for whatever reason. Any ideas? (Snippets in thread.)...

Trying to create simple POST function (Expected double-quoted property name)

```ts import prisma from '@/lib/prisma'; import { NextRequest, NextResponse } from 'next/server'; export async function POST(req: NextRequest) {...

Is prisma/extension-read-replicas Dead?

With last prisma 6x it appears the this extension is broken. Looking at the PR/open issues it seems that it may be abandoned. If so any alternatives or suggestions?

Switch to migrations after db push

Hello , I got a new project from a client , and they are using SQLite , I noticed they do not have any migrations , but rather db push directly , as this is not safe , I want to switch them to migrations , however how can we manage that without losing data as firing the migration will issue a drift

Includes in Prisma Pulse or Stream a db Views

idk if that sounds dumb or not but can i for example include a foreign table when a new event comes in from a pulse trigger (update/create) ? or if i create a view can i stream that directly when ever a new record got added?...

Prisma not getting past create function.

Hello, I'm using NextJS API routes and I'm having an issue creating record in the database. I am seeing the console.log("Test2") in the console but getting a 400 response code. I'm not sure what is causing this. ```js export async function POST(request) { const { uuid, product } = await request.json();...

[Noob] how do you add a optional search param to a findMany.

want it to match the title or content if provided otherwise match everything.

Prisma Autocomplete

How did you manage to get prisma autocomplete if you did? This isn't working for me Image running something like const db = new PrismaClient() gives autocomp but client.db.* doesn't...

PrismaClientInitializationError Prisma Client could no locate the Query Engine rhel-openssl-3.0.x

Good day Everyone, I am currently working on a project. Where I utilize Prisma ORM with PrismaAppSync. At the moment I am simply trying to perform some prisma client queries (without AppSync) simply to test. I continuously get this error while running my AWS Lambda
Prisma Client could not locate the Query Engine for runtime \"rhel-openssl-3.0.x
Prisma Client could not locate the Query Engine for runtime \"rhel-openssl-3.0.x
...

Prisma - npx prisma generate

I added a screenshot of the response I get when I'm trying to generate - but essentially it is saying it cannot find https://binaries.prisma.sh/all_commits/..../debian-openssl-3.0.x/query-engine.gz I've tried everything that ChatGPT could suggest, but still no dice. Any ideas from anyone? After two days, I'm at the point that I think it might be quicker for me to abandon Prisma and use something different - just so that I can get some progress......
No description

Migration issue in UAT

i am just using command like "npx prisma migrate deploy" to deploy migration files... i have 34 migration done.... but now what i have done is like take a copy of databse ......