The Prisma Client API:
Nested Writes
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
const updatedUser = await prisma.user.update({
where: {
id: 2,
},
data: {
posts: {
update: [
{
where: {
id: 2,
},
data: {
published: false,
},
},
],
delete: [
{
id: 3,
},
],
},
},
});
console.log(updatedUser);