Prisma

P

Prisma

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

Join

Help with Prisma schema

Im working on a NextJS project with Prisma and mangoDB I have an Activity model that has a relationship with Member when first creating an Activity it dosn't have members only and owner but i still want to set the default value to an empty array. when I try to do so with a post request and set members: [] to an empty array i get this error: ...
No description

ERROR P1001: Can't reach database server

Hi everyone, I'm getting the error message that my database server ist not reachable. But the server is running I can connect to the database with DataGrip.
No description

How to partition a database

Is there a way to partition a PostgreSQL database using Prisma? Or is it planned in the roadmap? It might be very useful for handling large amounts of data....

SessionTokenError & PrismaClient is not configured to run in Vercel Edge Functions/Edge Middleware

PrismaClient fails to initialize in an Edge Runtime environment (Next.js middleware) despite using the recommended configuration with driver adapters and Neon's pooled connections. The error persists even after following the official documentation for Edge compatibility. you can consult the issue I posted on github 👀 https://github.com/prisma/prisma/issues/25234...
No description

`prisma generate --sql` always hangs on vercel deployment.

I was just starting to incorporate typedSQL into my codebase ( love it btw ), but it's always hanging on the generate step, it's working fine on local.
Solution:
the related question here mentions the exact solution https://discord.com/channels/937751382725886062/1278064453375492230

nested raw query errors

WHERE
"postId" = ${postId} AND
${rootCommentId ? `"id" = ${rootCommentId}` : '"parentCommentId" IS NULL'}
WHERE
"postId" = ${postId} AND
${rootCommentId ? `"id" = ${rootCommentId}` : '"parentCommentId" IS NULL'}
...
Solution:
What version of Prisma ORM are you using? Have you tried TypedSQL? https://www.prisma.io/blog/announcing-typedsql-make-your-raw-sql-queries-type-safe-with-prisma-orm

Engine Not Found using Prisma with AWS Lambda.

Hello, I get the error: ``` "errorType": "PrismaClientInitializationError",...

schema "extensions" does not exist' error in shadow DB during initial migration on Neon

When running 'prisma migrate dev', I get this error on my first migration: 'Migration 0_init failed to apply cleanly to the shadow database. Error: ERROR: schema "extensions" does not exist' ...

Lazy load query engine in Cloudflare Workers

Hi! When using previewFeatures = ["driverAdapters"] deploying to most free plans fail due to the bundle size limit of 1mb. This is caused by the added bundle size of the query engine wasm. Wouldnt it be possible to lazy load the wasm when the worker is executed? ...

Pulse hosting

Hi there I want to use Prisma Pulse for our supabase/nextJS project. The app is hosted in vercel so I guess I will need to find another host for the backend stream-- what is recommended? Cloudflare workers? Is there a simple deployment guide? Thanks...

Prisma Interactive transactions not waiting on await statement

Prisma version: 5.19.1 Database Engine: Postgres I am running the following code structure inside an interactive transaction ```...

caprover can't connect via prisma

`` Prisma schema loaded from prisma/schema.prisma Datasource "db": PostgreSQL database "everpresent", schema "public" at "srv-captain--everpresent-postgres" Error: P1001: Can't reach database server at srv-captain--everpresent-postgres:5432`...

How to run prisma in nextjs middleware

I get this message, despite following the first guide
No description

Error when trying to connect to create PrismaClient

`` thread '<unnamed>' panicked at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\napi-sys-2.3.0\src\functions.rs:7:3: Must load N-API bindings stack backtrace: note: Some details are omitted, run with RUST_BACKTRACE=full` for a verbose backtrace....
Solution:
Using the binary engine fixed it

update enum on production

how to change the itemStatus to itemTaskStatus along with the enum without deleting the existing data. i want to use the expand and contract method but i keep on getting p3006 error. ```js model ItemTasks { //other value itemStatus ItemStatus @default(unpaid)...

How to get meta object (duration, row_read, row_written) in D1 + Prisma query?

How to get meta object (duration, row_read, row_written) in D1 + Prisma query?

Using the same schema on different projects

Hello! I have different projects that use the same prisma.schema. Every time i change something on my schema i have to update the file on all of the other projects. I wanted to ask if there's a way to sync them so all of my projects can point to a single schema and every time i wanna make a change i only have to worry for a single file. ...

Selecting random records from table

Hi! I would like to ask more experienced people for advice/ideas on how to use prisma to get random records from a table that meet some condition. I believe that fetching all the data from the table and then selecting random records is unnecessary and suboptimal. If anyone has an idea or knows how to achieve such an effect using prism, I would be grateful. 😄

Order by `rowid`?

Is it possible to order by (SQLite) rowid? I need to order by rowid as my table has no other natural sorting column. ```...

Drift detected but no changes in schema

Drift detected: Your database schema is not in sync with your migration history. The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database. `It should be understood as the set of changes to get from the expected schema to the actual schema....