Mozil
Mozil
PPrisma
Created by Mozil on 8/28/2024 in #help-and-questions
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 *;
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
9 replies