Support for ON CONFLICT
Postgres 9.5 introduced the ON CONFLICT
clause which enables upsert behavior.
Would you be open to a PR to add support for this to Massive as an option on insert
? Simplest solution would be to add a second options
parameter. e.g.
db.table.insert({id: 'might exist'}, {onConflict: 'do nothing'})
// or
db.table.insert({id: 'might exist'}, {onConflict: 'do update'})
It should be possible to generate the rest of the do update
clause automatically.
Alternatively the options could be flags like {ignoreConflict: true}
and {upsert: true}
respectively.
As mentioned in https://github.com/dmfay/massive-js/issues/278#issuecomment-228756836 this this could also be used for save
.