onDuplicateKeyUpdate ???

i don't suppose anyone knows how to actually use this method? zero documentation on it and the planetscale dbClient only recognises this method after the values function. There is no "onConflictDoUpdate" or "onConflictDoNothing"....i just want it so if there is an item with the same slug, ignore the query...
export async function seed(client: DbClient) {
await client
.insert(customerMedicalCategory)
.values(
data.map((item) => ({
id: ulid(),
name: item.name,
slug: paramCase(item.name),
description: item.description
})),
).onDuplicateKeyUpdate(???)
}
export async function seed(client: DbClient) {
await client
.insert(customerMedicalCategory)
.values(
data.map((item) => ({
id: ulid(),
name: item.name,
slug: paramCase(item.name),
description: item.description
})),
).onDuplicateKeyUpdate(???)
}
1 Reply
ejoo
ejoo2y ago
.onDuplicateKeyUpdate({
set: {
description: item.description
},
})
.onDuplicateKeyUpdate({
set: {
description: item.description
},
})
Want results from more Discord servers?
Add your server