Patryk
Patryk
DTDrizzle Team
Created by Patryk on 10/8/2023 in #help
onConflictDoNothing is not returning values
Hey, Given the following query:
const competition = await db
.insert(competitions)
.values({
name: data.competition,
})
.onConflictDoNothing()
.returning();
const competition = await db
.insert(competitions)
.values({
name: data.competition,
})
.onConflictDoNothing()
.returning();
It only returns the data when it has inserted unique row, but when row exists, it doesn't return me the existing row. The behaviour I am seeking, is if the row exists, do not insert it, but give it back to me anyway, because I need to know the ID.
5 replies