Prisma

P

Prisma

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

Join

Prisma so slow in localhost with remote Postgresql (NextJS)

My website in local with remote postgresql is so slow but all good on deployed website using NextJS

Is support for Postgres composite types planned?

I'm just wondering if there's a specific reason for it not being currently supported since it's been a thing for a while

Prisma and CUIDv2

why prisma doesnt support cuidv2? in sense that it doesnt let you generate cuidv2 by default

Nested update when creating single record

Hi Prisma-Community, I want to set two fields to null when I create a user but I have no idea if this is possible. ``` model Membership { id String @id @default(cuid())...

Typedsql Type?

```sql -- @param {product_state} $1:state SELECT * FROM product WHERE 1 = 1 AND state = $1...

I need help with my schema, it doesn’t let me migrate

Hello, I get this error when trying to migrate to my remote database: Error: P3006 Migration 20240827190544_fix_relations failed to apply cleanly to the shadow database. ...

TypedSQL type safety over time

for TypedSQL, if i write a query and use it, then a month later i modify one of the tables via a migration, will I be notified if my query is no longer valid

Cant connect to supabase using accelerate

I have a problem setting up accelerate with supabase postgres. Supabase requires me to use ?pgbouncer=true at the end of the connection string. When i do it on the prisma accelerate dashboard it returns: One or more fields were invalid: [connectionString]. Tried many things but couldn't make it work. Am i doing something wrong? my connection string is similar to the following one: postgres://[db-user].[project-ref]:[db-password]@aws-0-[aws-region].pooler.supabase.com:6543/[db-name]?pgbouncer=true...

TypedSQL - Generating without a DB connection

Hey everyone! We are trying out TypedSQL and it's working great for now. The main issue we're having is that to generate the complete client (with the --sql flag), a working database connection is required. As we're building our production containers on a stateless CI environment, we would like to avoid this constraint. Is there a way to correctly infer and build TypedSQL types directly from the schema.prisma file?...

Distinct doesn't work for some reason

Hey guys, I need help with something. I have this model...

is it possible to order a column how I want it?

For example, I have a table with a column that has values A,B,C,D when I query that table, I want to sort the results by D,B,A,C...

Is something happened with PrismaClient and adapters?

Solution:
I forgot to include this previewFeatures = ["driverAdapters"]
No description

How can one test out the Pulse service in light of the superuser limitation?

Hi, I am interested in testing out the Prisma Pulse service. However, according this doc - https://www.prisma.io/docs/pulse/known-limitations - you have to have a superuser role in order to use this service. I have a superuser role for my local databases but I use services like Render and Supabase for my deployed instances. None of those services (for good reason) allow for superuser access. How are we supposed to test out Pulse if we do not have superuser access? Does this mean that the only...

TypedSQL - JSONB fields

Using TypedSQL, I noticed that JSONB fields are inferred as JsonValue. Is there a way to get more specific type inference for complex JSON structures in PostgreSQL queries, or is this a current limitation of TypedSQL?

Multiple Schema File issues

hi, so im using as followed on the blog about multiple schema files, and it seems that when i try to use npx prisma format or npx prisma generate, it fails to load those other schema files, i dont have any model in main file tho, so not sure if that's the issue, but it shouldnt be, here's also my file tree: ```shell prisma ├── schema...
Solution:
seems like all files have to be in the schema directory, that's kinda annoying

Prism generate fails on VPS but not locally

executing this script inside CMD in Dockerfile, it fails thjough, any idea where a problem could be?...
No description

How to utilize Prisma defined in back-end to the front-end

Hello. I'm developing a project without NextJS, just using Vite TypeScript React. I've decided to use Prisma in my NodeJS backend. I'm currently writing out components for React and it would be really handy to be able to use the types defined in my Prisma schema from the back-end in my front-end. Is there any way I can do this without creating a reference to my backend in my frontend? (Trying to maintain decoupled architecture)...

How to include prisma/sql in serverless lambda?

I'm using serverless-webpack-prisma to include prisma client in lambda but I don't think it currently includes prisma/sql in the deployment as I get the following error: "Runtime.ImportModuleError: Error: Cannot find module '.prisma/client/sql'".

how do I do this upsert query in prisma?

```pgsql INSERT INTO public."CartItem" ("itemId", "userId", "quantity", "ordered") VALUES (${product.id}, ${user.id}, 1, false) ON CONFLICT ("itemId", "userId") DO UPDATE SET ...

Complicated groupBy query

Hey there, I am attempting to do something with Prisma that may be undoable. I am still very new to web dev and Prisma, so be aware I don't doubt I'm missing something obvious here. I would like to use post.findMany() to find posts for a specific user, but in this query I would like to include the number of reactions associated with a post for a kind of reactionType. In my project, I am using emoji reactions on posts, and I need to return the number of reactions per emoji type (reactionType). However, I am at a loss for how to do this without many queries per request. Using groupBy() works if I grab the posts first and then use the post.id of each post... ...
Solution:
Hey Jon, your query worked well. I modified it return the structure I needed: ```sql -- @param {String} $1:Post ID -- @param {String} $2:User ID...