import { kysely } from "https://dotland.deno.dev/x/kysely_postgrs_js_dialect@v0.27.3/deps.ts";
const { InsertQueryBuilder } = kysely;
Adds on duplicate key update
to the query.
If you specify on duplicate key update
, and a row is inserted that would cause
a duplicate value in a unique index or primary key, an update of the old row occurs.
This is only implemented by some dialects like MySQL. On most dialects you should use {@link onConflict} instead.
Examples
await db
.insertInto('person')
.values(values)
.onDuplicateKeyUpdate({ species: 'hamster' })
Returns
InsertQueryBuilder<DB, TB, O>