Prisma

P

Prisma

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

Join

Cloudflare D1 support

Hi, I've searched the server for this and found an answer from Nurul 2 months ago saying this feature is planned. From what I've seen you guys don't like to share ETAs so instead could you just tell me if works on this has been started or not? Thanks! Looking forward to this...

I need to convert find many query to find raw query...

@kapa.ai await this.prisma.incident.findMany({ where: { title: { contains: filter?.title },...

UpdatedAt value changes if no field value changes?

What happens to the UpdatedAt field, if I over write a value of a field and no other fields value is changed. Does the updatedAt fields value reflect the current datetime or it remains unchanged? Example, there is a flag field, with value 1. I perform a update on that record and still assign 1 as value to the flag field. Nothing else changes. Does the updatedAt fields value automatically get updated or it does not change - as non of the value in the record actually changed....

[ADVANCED] Prisma Extensions - dynamic typing

I'm trying to create a $allModels extension with proper typing and have been struggling. This is what I was able to cobble together: ``` model: {...

Filter: return both or one

I have the case where I want to narrow the search with 2 keywords, 2 keywords work, but 1 alone is not working. I have tried: ``` where: { AND: [{ type: { in: input } }, { priceType: { in: input } }], OR: [{ type: { in: input } }, { priceType: { in: input } }],...
No description

Cannot select both '$scalars: true' and a specific scalar field 'tags'.

This is my relevant schema ``` model EventTag { id Int @id @default(autoincrement()) @db.UnsignedInt eventUserId Int @db.UnsignedInt...

[ACCELERATE] Timed out fetching a new connection from the connection pool

I'm using Prisma Accelerate with the @prisma/client/edge client and I'm getting the following error: ``zsh 10:48:02 AM [vite] Internal server error: Invalid prisma.facility.count()` invocation: ...

User data not generated at prisma

after sign up new user, user data is not created

Why getting typescript error only selecting few fields?

```js const admins = await this.prisma.admin.findMany({ where: { ...filters, },...

StringFieldUpdateOperationsInput on @id

when I have a schema set up like this:
model User {
hash String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
model User {
hash String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
...
No description

multiSchema variable

Hi all, im trying to use .env to replace schemas value `datasource db { provider = "postgresql" url = env("DATABASE_URL")...

Deploying to Railway

I am adding prisma orm to my elysia js project. I was wondering if i needed to modify my railway custom start command to run the migration before starting the elysia app, or if railway should defaultly handle this. I tried searching before making a post but couldnt find any info of people adding this to their deployment pipeline. every tutorial had people manually doing the migration

Query based on Time

I've a collection where I save date and time of the users last access. I have to send a notification exactly on same date and time next month. How can I write the query for it? I already have a cron job setup. I just want to know how to write the query for it. I've previously worked with date, but I'm not sure how to query based on date and time. Any help much appreciated. Thank you .....

How do I find records then select only 10 of them between (example) 40 and 50

Hello. basically I need to create pages because I don't want to print 100 records on the screen. I only want to select 10 of them. If I have 100, page 1 will show 1 to 10, page 2 will show 11 to 20 etc. ```ts const getAllUserMedia = async (email: string) => { const res = await prisma.media.findMany({where: {user: email} })...

Frequent constraint failed on id when using @id @default(autoincrement())

Is there anything I should know about how @id @default(autoincrement()) works? We're using postgresql. We find that if you delete a row and then insert that same row with the same id, we hit a prisma:error Unique constraint failed on the fields: (id)....

Single table inheritance

How to use Single Table Inheritance with prisma ?

Pulse error: Could not reach the specified datasource db url

New Pulse user here (experienced Prisma ORM user). Trying to connect to my local db via connection string: postgresql://postgres:@localhost:5432/my_db?schema=public. At first I received an error that a password is required, so I stopped the server, added a pw of postgres to the database, changed connection string to postgresql://postgres:postgres@localhost:5432/my_db?schema=public, and then restarted the server. But still I continually get the "Could not reach specified db url" error. My NextJS app using the same connection string with Prisma ORM runs just fine, as does DBeaver for accessing the database. But for whatever reason, Pulse cannot connect. Any thoughts? Full error message below. I'm on PostgreSQL 16. I’m super eager to try Pulse, both locally and then ideally in an AWS/RDS production environment. Thanks.
Prisma Pulse could not reach the specified datasource db url. This could be caused by an incorrect datasource URL or database firewall rules, or certificate issues. This is probably not a problem with Prisma Pulse. The network error was: "server did not respond on the specified hostname and port. Proxy request failed."...

Connecting relations misunderstanding

As I understood so far its either you just add foreign key if you want to connect with existing record or into the relation object you add connect, however i got a strange error, the studentId (foreign key) is provided but it still asks me for a student (relation), any ideas why?
No description

Pull Operator not Existing?

```ts await db.$transaction([ db.account.update({ where: { id: values[0],...