import { kysely } from "https://deno.land/x/kysely_deno_postgres_dialect@v0.27.1/mod.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 onConflict instead.
Examples
await db
.insertInto('person')
.values(values)
.onDuplicateKeyUpdate({ species: 'hamster' })
Returns
InsertQueryBuilder<DB, TB, O>