Questions tagged [prisma2]

For questions about Version 2 of the Prisma ORM

232 questions
0
votes
0 answers

Prisma many to many

How to add a car to favorites via connectOrCreate (similar to the basket). I have a connection between Car model and SessionClient model many to many. The machines already exist in the database, customers receive a token when they log in on the…
0
votes
1 answer

Error validating field `category` in model `Product`

Prisma Models ErrorIm new in this stackoverflow, please Help me, I have a problem with Data Modeling in Prisma like this and error like this : "Error validating field category in model Product: The relation field category on model Product is missing…
Bangjoule
  • 1
  • 1
0
votes
0 answers

How to soft delete a explicit many to many relation in prisma and what are the best practices in doing so

I want to implement soft delete in explicit many to many relation using prisma. I want to somehow disconnect the link betweeen them and mark both user and all its memories as deleted true. is it a good approach ? or how to do this in genral My…
0
votes
0 answers

Prisma added new column but I'm unable to query it, recieve error 400

I recently added a new boolean attribute to my org table. I checked with prisma studio to verify that I added the column correctly and tried to mutate it, which worked perfectly. I am now trying to query that value to use it in my code, but I keep…
0
votes
0 answers

How to insert data in a Many-To-Many Relationship with Prisma

I'm having problems with inserting data in a many to many relationship, probably it's because i'm still new to prisma orm. Here is how I'm creating the models: generator client { provider = "prisma-client-js" } datasource db { provider =…
crispengari
  • 7,901
  • 7
  • 45
  • 53
0
votes
0 answers

Can't create a nested many To many properties

I've been stuck on this problem for hours. I'm trying to create an object linked by a many to many relationship. However, I get this error when the function is invoked: Unknown arg 0 in data.merchandises.create.0 for type…
Fizzy-59
  • 31
  • 3
0
votes
0 answers

crud for a many to many relationship in prisma

so, i want to create a memory for a user and add the user to the memory api using prisma. in this user table and memory table are connected by a many to many relationship. They share a common table userMemory. schema.prisma model User { userId …
0
votes
0 answers

Prisma connect product to users with quantity

I have a list of products, and a list of users and I want to be able to relate users to what products they have but also what quantity they have of each product. I've setup my user schema like this: model users { id String …
alienbuild
  • 246
  • 2
  • 15
0
votes
0 answers

Prisma save model with many associations

This is possible in prisma ? organization model has one array of store store model has one array of phones ` const organization = await this.prisma.organization.create({ data: { name: accountForm.name, clifor: accountForm.clifor, …
0
votes
1 answer

Prisma JSON upsert "must not be null"

I have the following schema: myField Json? @default("{}") (notice the ?) And when I try to insert a null value to that json field I get: ... must not be null. Please use undefined instead I then tried to make…
funerr
  • 7,212
  • 14
  • 81
  • 129
0
votes
0 answers

Prisma: Finding users in the same chat room

model Chatroom { room_id Int @id @default(autoincrement()) Participant Participant[] Message Message[] } model Participant { participant_id Int @id @default(autoincrement()) roomId Chatroom @relation(fields:…
0
votes
0 answers

Ordering Implicit Many-To-Many Relations in Prisma?

I'm not sure if this is possible: Say I have 2 tables and a many-to-many relationship between them. Let's say a Module can have multiple Lessons, and a Lesson can appear in multiple Modules. However, I'd like the lessons in each module to be in a…
antonwilhelm
  • 5,768
  • 4
  • 19
  • 45
0
votes
0 answers

createMany with realtion with prisma.io

I have two models: model Terminal { terminal_id Int @id @default(autoincrement()) terminal_name String created_at DateTime @default(now()) updated_at DateTime @updatedAt modcods Modcod[] …
0
votes
1 answer

How can I apply multiple filter with prisma?

I've an ecommerce project where i was working on filtering the products using prisma query. 1.) http://localhost:3000/products/[category] ---> should return all products based on catgeory 2.)…
Aegon
  • 19
  • 7
0
votes
1 answer

prisma One-To-Many relationship isn't working

I really know that the problem Is with me and Prisma's one-to-many relationship is working alright but just bear with me please. 1. This is the model's part where I have the problem: model Product{ Id Int @id @default(autoincrement()) Uuid…