Prisma

P

Prisma

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

Join

Order Conversation based on Chat `createdAt`?

I’m building a chat application using Prisma (PostgreSQL) for my backend, and I need to order conversations by the latest message's createdAt timestamp. However, I’m struggling to find a way to achieve this without adding an additional field like latestMessageCreatedAt to the Conversation model. Here's my Prisma schema for Conversation and Message: ```prisma...

Cant run prisma generate at build time

My build env does not have access to my database. Can I run prisma generate before deploying or at runtime?

error while trying to create Prisma pulse project.

error:
Prisma Pulse could not connect to the datasource db url. PostgreSQL returned the error: "must be superuser to create FOR ALL TABLES publication". This is probably not a problem with Prisma Pulse.
Prisma Pulse could not connect to the datasource db url. PostgreSQL returned the error: "must be superuser to create FOR ALL TABLES publication". This is probably not a problem with Prisma Pulse.
...

Weird prisma error

any idea what does it make?
No description

Generate prisma client programmatically

I tried looking through existing Github issues, discussions, and here in Discord with no success, but I'd like to generate the client package programmatically if possible. For example, in a Prisma schema file I might have the following block: ```js...

Using the same GraphEntry model for different graphs

I've got two models and am trying to have two different graphs using the same GraphEntry model with a different graph type. Any way to do this? ```ts model House { id Int @id @default(autoincrement())...

findMany - query table for all values not in another

hey, just trying to sort out a minor problem with a program of mine i'm trying to query a table, Track, and only return the records from the table if TrackID is not in another table, TrackToPlaylist in postgres, syntax for this would be similar to the following: ```sql...

Error when npx prisma migrate dev

Im getting a Oops, an unexpected error occurred! Error in Schema engine. Reason: [D:\a\prisma-engines\prisma-engines\schema-engine\sql-schema-describer\src\walkers\column.rs:74:61] called Option::unwrap() on a None value...

Schema Visualizer

Has there been any thoughts about a schema visualizer in your PDP account? Something similar to Prismalizer but built right into your control plane? I'd love a feature like that, especially if it would automatically consolidate split schemas. (ignore the off-topic tags, there wasn't a relevant option)...

Issue with migrations

Hi! I've been trying to apply a change to my schema but been facing some errors and im not sure what im doing wrong, do you think you can help me please? I tried to add a new table to my prisma schema, but every time i try to apply the migration with npx prisma migrate dev --name sample_name i get a message saying that a foreign key on one of the tables i had already on the schema was removed and then added again. Im not sure where this change comes from or if it could be a bug. That same message asks me to restart my database and that all data will be lost. I dont want my data to be lost, so i tried to do a baselining. As the documentation states y moved my migration folder and followed the steps, when i tried to do the migration again i got an error saying that all of the migration folders were missing on my folder, so i restored it....

Bulk relations

I have a Property entity that has a photos relationship (1:many). I am trying to bulk insert 100 properties, and then relate their photos in bulk as well. Is this possible with prisma/sql? Or do I need to loop over the properties after and do it 1 by 1?

Prisma query tracing

Hello! Is there any update on this issue? Would be super useful to be able to add route of the original query that can be inspected in eg. GCP Query Insights (: https://github.com/prisma/prisma/issues/10746...

RawSQL Caching support

Will Prisma Accelerate ever support caching for complete rawSQL? Is there pros and cons of this?...

Deleting db entries doesn't seem to free up the space?

I've added a buuuuunch of data recently that added up to about 50mb and today I cleared it. However, I found that the amount of storage space taken by my .db has not went down even a little bit! It went up from ~30mb to ~80mb, and it remains 80mb+ after clearing the table that caused the size to go up. Any idea what's the cause of this, and how I could clear it?...

up down migration creation

I have started creating down migrations with npx prisma migrate diff and up with npx prisma migrate dev --name ${name} --create-only I want to have the up and down migration in the same folder but it puts the down one in the root of my project. Anyone got a nice solution or alternative?...

inconsistant use of id field and relation create

why is this createMany in relation somehow is using siteId instead of site: connect? ```const oldChat = await prisma.chat.create({data: { token: generateRandomString(), module: {...

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