Mozil
Mozil
PPrisma
Created by Mozil on 8/28/2024 in #help-and-questions
how do I do this upsert query in prisma?
this is the cart item model
9 replies
PPrisma
Created by Mozil on 8/28/2024 in #help-and-questions
how do I do this upsert query in prisma?
model CartItem {
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId BigInt
Item Item @relation(fields: [itemId], references: [id])
itemId BigInt
quantity Int
details CartItemDetail[]
createdAt DateTime @default(now())
ordered Boolean
// if order is TRUE, this must exist
OrderItem OrderItem?

@@id([userId, itemId])
}
model CartItem {
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId BigInt
Item Item @relation(fields: [itemId], references: [id])
itemId BigInt
quantity Int
details CartItemDetail[]
createdAt DateTime @default(now())
ordered Boolean
// if order is TRUE, this must exist
OrderItem OrderItem?

@@id([userId, itemId])
}
9 replies