Simple patcher for Knex. It adds the .onDuplicateUpdate() function to knex's query builder.
npm install knex-on-duplicate-update

Simple patcher for Knex. It adds the .onDuplicateUpdate() function to knex's query builder in order to add support MySQL's on duplicate key update columnName=Values(columnName).
Knex (v0.21.10) added an official upsert functionality with similar capabilities which supports MySQL, Postgress & SQLite.To use this lib, first you will have to install it:
```
npm i knex-on-duplicate-update --save`
or`
yarn add knex-on-duplicate-update
Then, add the following lines to your Knex set up:
`javascript
const knex = require('knex')(config);
const {attachOnDuplicateUpdate} = require('knex-on-duplicate-update');
attachOnDuplicateUpdate();
`
`javascript`
onDuplicateUpdate(...columns: Array<{[key: string]: string} | string>): Knex.QueryBuilder
javascript
await knex.insert({id: 1, name: 'John', email: 'john@mail.com'})
.into('persons')
.onDuplicateUpdate('name', 'email');
`Setting a fallback value for a column
`javascript
await knex.insert({id: 1, name: 'John', email: 'john@mail.com'})
.into('persons')
.onDuplicateUpdate('name', {email: 'john-exists@mail.com'});
`knex-paginator`.