PrismaP
Prisma2y ago
8 replies
Łowiznine

how do I do this upsert query in prisma?

INSERT INTO public."CartItem" ("itemId", "userId", "quantity", "ordered")
VALUES (${product.id}, ${user.id}, 1, false)
ON CONFLICT ("itemId", "userId") 
DO UPDATE SET 
  quantity = "CartItem".quantity + 1
RETURNING *;


basically I'm increasing the quantity by 1
Was this page helpful?