returning with onConflictDoUpdate - How do I know if it was updated?

If I do:
await db.insert(users)
.values({ id: 1, name: 'Dan' })
.onConflictDoUpdate({ target: users.id, set: { name: 'John' } })
await db.insert(users)
.values({ id: 1, name: 'Dan' })
.onConflictDoUpdate({ target: users.id, set: { name: 'John' } })
Without returning I know if the row was added or edited, but I don't get the ID - With returning, I get the id but I don't know if it was created or just updated. Any way to know both?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server