Inserting with Relation
Hi,
What is the way of inserting a new record with a relationship in Drizzle. I understand that Prisma abstracts this away as if you are inserting everything as once but under the hood it breaks it up into multiple queries. Is there anything like this in drizzle?
3 Replies
use transaction
check drizzle doc about transaction
Ok, so would I just do the inserts sharing the same foreign keys?
yes insert in all related table inside a transection. so that if one failed it can rollback automatically