Prisma

P

Prisma

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

Join

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

Prisma.Decimal is not a Decimal

i am using prisma with postgresql and i got a lot of problems with prisma.decimal. i tried to store it as new Prisma.Decimal(number Input) and when i get it back from Prisma, i get an [object Object] there is no way i can convert this into a Decimal. Every Method -> toNumber() etc. results in a error, that this is not a function. So i tried to do the following Prisma.Decimal.IsDecimal(Object form Database), as u can see the result is false. ...
No description

Does 'asc' sorting order sorts my createdAt timestamps from the oldest to the latest or viceversa?

Hello everyone, I want to sort my MySQL records by the createdAt timestamp, so if I specify the orderBy to be asc, then will it sort the records from the oldest to the latest or vice-versa? Thanks in advance?...

how to create the _prisma_migration table in a specific schema?

I do not have perms on the Public schema due to how the db and its perms are set up. Is there a way to config prisma so that the migrations table will be created in a different schema? For example, under a "prisma" schema or something like that?...

Multiple Prisma clients and connection pooling

I would like to use multiple Prisma clients in my application, basically like so: ```ts const p1 = new PrismaClient({config}) const p2 = new PrismaClient({config})...