onConflict
Configures the ON CONFLICT clause in a fluent and safe manner.
// Re-enlist a legionnaire under the same legion — update their rank if the record already exists
dataAccess.insertInto("legionnaires")
.values(data)
.onConflict {
onColumns("name", "legion_id")
doUpdate(
"rank" to "EXCLUDED.rank",
"re_enlisted_at" to "NOW()"
)
}
.execute(data)Content copied to clipboard