Kay Khan
06/15/2022, 10:06 AMimage.connect
and brand_indusry.createMany
we'd want them to also fail right?
I guess its obvious you can't really connect or have a relationship to createMany if nothing is made.
const newBrand: Prisma.brandCreateInput = {
id: uuid(),
name: payload.name,
website: payload.website,
slug: payload.slug,
image: { connect: { id: payload.image_id } },
brand_industry: { createMany: { data: industries } },
};
const createBrand = await PrismaService.brand.create({
data: newBrand,
});
Richard Ward
06/15/2022, 10:54 AMcreate
is done in a transaction so the entire transaction is rolled back meaning the image
and brand_industry
records will not be created or affected.Kay Khan
06/15/2022, 10:55 AM