Query for Prisma like insert in multiple joined tables

Ssubhendupsingh4/10/2023
Is there a way to achieve insert in multiple tables joined by foreign keys in one query like Prisma?

{
                orderStatus: OrderStatus.CART,
                organization: {
                    connect: {
                        id: orgId
                    }
                },
                products: {
                    create: {
                        price: price,
                        product: {
                            connect: {
                                id: product.id
                            }
                        },
                        quantity: orderProduct.quantity,
                        taxPercent: taxPercent,
                        variants: {
                            createMany: {
                                data: variantsOnOrder
                            }
                        }
                    }
                }
            }

Or subsequent inserts in a transaction is the way?
Bbloberenober4/10/2023
Prisma doesn't do it in one query because it's impossible to write such a query in SQL. It does multiple queries behind the scenes. With Drizzle, you'll need to write those queries yourself.
Ssubhendupsingh4/11/2023
Alright, Got it!
Mmilon275/19/2023
so we will always use transaction right whenever you need to insert into multiple tables?
Rrphlmr5/19/2023
Yep, this is the way