Issue with 'insert on conflict do update where'

I am using
db.insert(lastHeaterMetricsTable)
.values(heaterEntityWithMaxTime)
.onConflictDoUpdate({
target: lastHeaterMetricsTable.deviceId,
set: heaterEntityWithMaxTime,
where: lt(
lastHeaterMetricsTable.receivedAt,
heaterEntityWithMaxTime.receivedAt,
),
})
.execute()

But as the query result I get the following:
where
statement is before
do update
, that's why query failes. Drizzle ORM 0.25.4
Screenshot_2023-05-22_at_11.17.04.png
Was this page helpful?