const data = [
{organisationId: "ABCD", accountId: "001", price: "120000"},
{organisationId: "EFGH", accountId: "002", price: "59000"},
];
await db
.insert(myTable)
.values(data)
.onConflictDoUpdate({
target: [myTable.organisationId, myTable.financialAccountId],
set: data[0], // Putting [0] works but how to dynamically set the value to the relevant object in data array?
});
const data = [
{organisationId: "ABCD", accountId: "001", price: "120000"},
{organisationId: "EFGH", accountId: "002", price: "59000"},
];
await db
.insert(myTable)
.values(data)
.onConflictDoUpdate({
target: [myTable.organisationId, myTable.financialAccountId],
set: data[0], // Putting [0] works but how to dynamically set the value to the relevant object in data array?
});