Tharaka
Tharaka
DTDrizzle Team
Created by Tharaka on 5/1/2023 in #help
Inserting records into related tables
Noted. Thanks @Dan Kochetov
9 replies
DTDrizzle Team
Created by Tharaka on 5/1/2023 in #help
Inserting records into related tables
It gets a bit trickier when your payload is an array. Ex 👇 . Prisma has a way of nesting the inserts. Just wondering if I can do the same with Drizzle
const payload = {
"products":[
{
"name":"Product 1",
"description":"Product description 1",
"variant":[
{
"name":"Variant 1",
"description":"Variant description 1"
},
{
"name":"Variant 2",
"description":"Variant description 2"
}
]
},
{
"name":"Product 2",
"description":"Product description 2",
"variant":[
{
"name":"Variant 3",
"description":"Variant description 3"
},
{
"name":"Variant 4",
"description":"Variant description 4"
}
]
}
]
}
const payload = {
"products":[
{
"name":"Product 1",
"description":"Product description 1",
"variant":[
{
"name":"Variant 1",
"description":"Variant description 1"
},
{
"name":"Variant 2",
"description":"Variant description 2"
}
]
},
{
"name":"Product 2",
"description":"Product description 2",
"variant":[
{
"name":"Variant 3",
"description":"Variant description 3"
},
{
"name":"Variant 4",
"description":"Variant description 4"
}
]
}
]
}
9 replies
DTDrizzle Team
Created by Tharaka on 5/1/2023 in #help
Inserting records into related tables
I see. Thanks for the suggestion @doiská
9 replies