Prisma

P

Prisma

The official Discord server of Prisma! Find us online at prisma.io

Join

Cursor based pagination without numeric id available in table

When using cursor based pagination (https://www.prisma.io/docs/orm/prisma-client/queries/pagination#cursor-based-pagination) what if a table has no sequential number? Imagine a Person table with an id which is a guid, or maybe just in the format 'firstname-lastname' (like 'vivian-defoe'). And then I would like to do cursor based pagination in combination with an user supplied order (like via a REST api users can provide the sorting option like first_name, last_name, gender, date_of_birth, place_name_of_origin. Is that possible, or should I use offset pagination in that case?...

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...

what is the error code for

Unknown field asdf for select statement on model Blogs. Available options are marked with ?. error in prisma?...

[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

How can I create if not exists?

How can I create if not exists?

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

Is anyone able to Upsert data to the database?

Just tried to store some data, had no issues locally, but running studio, the latest deployment I just made wasn't there. Is anyone else having this issue?

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)....