Prisma

P

Prisma

The official Discord for the Prisma ORM and Prisma Data Platform! Learn more at https://prisma.io

Join
darkTower
darkTower5/17/2024

Should I stick with raw SQL?

I'm migrating an on old PHP app I wrote 11 years ago. In the new stack I'm using Prisma for new calls but I have an old SQL statement I know works. Should I stick with sending it as raw SQL or is there a better way with Prisma? `` const columns = e.date_test_completed AS 'CompletedDate', c.name AS 'courtName', c.number AS 'courtId', COUNT(*) AS 'count', SUM(c.court_fee) AS 'Fee'; const query = SELECT ${columns}...
shindiogo
shindiogo5/17/2024

$on

Hello, im trying to create a connection and catch the erros in a single point using $on, but im getting and error : Argument of type 'string' is not assignable to parameter of type 'never'. Anyone know why?...
Gabriel
Gabriel5/17/2024

Prisma migrations working with more than one container

(English is not my native language, I hope this is understandable.) Hello everyone, I would like to point out that I am new to prisma and am exploring the first complexities in the projects I have been working on. I'm migrating a monolith project to microservices using Nest.js and Docker, and following the prism documentation, I have the history of my migrations in the migration folder. My question is, how can I make all the services have the database synchronized, since they all consume the sam...
Quinn
Quinn5/17/2024

Data Location Security

Hi! My company is looking to subscribe to pulse / accelerate but we have data requirements around data location. Is there anywhere that talks about data storage / transient data passthroughs? IE, the data flow through X country or caching is with X company...
perroudsky
perroudsky5/17/2024

The response size of the query exceeded the the maximum of 5MB

Hi prisma team, Since I've set up Accelerate, some queries won't work because of the 5mb limitation. Strangely, the limitation is activated for a small query fetching approx 300 records, whereas it's working fine for far bigger queries. here's the model: model User {...
ahmetfalan
ahmetfalan5/17/2024

NextJS version 13.5.4 in prod getting Internal Server Error

Im using 13.5.4 of the nextjs version and I tried other versions too but I always get internal server error in prod mode but in local there is no problem. I tried other databases too but I still get the same error. There is no problem with databases because I tried with other projects too but they seem to work. I am using AWS Amplify for hosting and AWS RDS for databases. By the way I can connect to databases with data management tools. What could be the reason for this? Prisma and Prisma Client version 5.14.0 The steps when I follow while installing prisma:...
Virgile
Virgile5/17/2024

How to authenticate Prisma Optimize in a VPS ?

Hi everyone. I enabled Prisma Optimize on a project to try it out. On local, I can authenticate using the browser, all works well. On a VPS though, I pushed to prod and my website crashed. How can we authenticate to Prisma on a VPS ? What command could I run before hand to avoid this issue ?...
foobar
foobar5/16/2024

In a Prisma result extension, is it possible to require ("needs") a relation?

Hi! I love extensions, in particular result extensions that I use extensively! For now, I use it only with fields that belong directly to the model, but I often want to "require" (the "needs" field) fields that are in a relation. Is that possible?...
Order
Order5/16/2024

I want to find a user with either email or username but I'm getting a typescript error

I'm setting up nextauth in nextjs with prisma and postgres and I want the user to be able to interchangably log in with either email or password. So I set this up: ` async authorize(credentials) { const user = await prisma.user.findUnique({ where: { OR: [ {...
mpgalaxy
mpgalaxy5/16/2024

Filter (where) for nonexistant boolean field

Hi, is there a way in prisma to filter in where for a nonexisting boolean field ? Curent situation: prisma 4.10 + graphql + nexus with mongoDB We introduced a Boolean field later on and the older datasets don't have this field. In my queries I want to filter for this field to be false or nonexistant, but undefined is treated differently in prisma and isSet or null are not allowed for boolean fields. How can I filter for these conditions ?...
kmj
kmj5/16/2024

Prisma extend can change db pointing to?

is there anyway change the prisma db? change under extend or new prisma, i need to for multitenant
Mohammad Orabi
Mohammad Orabi5/16/2024

Setting Connection limit in gcp cloud run and cloud sql

What is the best practice when setting the connection limit of prisma in gcp cloud run? * I am using postgres from cloud sql * I have a master database with 14 cpu and 20GB ram * 3 replicas each with 10 cpus and 20GB ram , each can handle 500 connections...
forrestzhong
forrestzhong5/16/2024

Can composite type contain a list of another composite type?

i am trying to define a composite type Token as below, which will contain a list of another composite type Chain, is this valid? i don't see any documentation saying if this is valid or not. ``` type Token { id String symbol String...
3145SML
3145SML5/15/2024

Type Error

Hi, im trying run code using prisma ORM and cli, but, i when type "npx prisma migrate dev", works, but appears type errors.
Jamie Buck
Jamie Buck5/15/2024

Prisma Migrations With Turbo Repo

Hi - im using turborepo to house multiple apis, some frontends, and some cloud functions all within a single repo. I also have multiple shared packages that i use accross those deployables. One of the packages im introducing is packages/prisma-orm which will house all of my prisma logic - schema, migrations, etc. Because i have several different backends using this, each scalled horizontally, I want to make a standalone service for running migrations as a CI step. The issue is - if the `p...
battlesheep123
battlesheep1235/15/2024

Relation not included in the generated types

Hello, I have the following model, generated from a database-first approach. ```...
ShaDoW
ShaDoW5/15/2024

Need help with schema

I have models - Question and Answer There is a one to many relation : 1 Question has many Answers But I also need a relation for a single Answer, I will show the schema file, it is currently giving me error ...
Jannik
Jannik5/15/2024

Prisma is not using test env file

"test": "cross-env NODE_ENV=test && dotenv -e .env.test -- npx prisma db push && vitest"
"test": "cross-env NODE_ENV=test && dotenv -e .env.test -- npx prisma db push && vitest"
it is creating the following db ```...
tzezar
tzezar5/15/2024

Does prisma allow use of Shared Primary Key?

if so, what should the model look like? Sorry if this has already been asked somewhere, I can't find anything.
Next