node-etl
node-etl copied to clipboard
Postgres Upsert - Unique Field Support
Currently, postgres upsert only takes primary keys into consideration for generating ON CONFLICT statements. It would be helpful to also be able to upsert against unique fields. One solution would be to be able to pass in 'pkeys' via options.
Current code:
if (this.upsert) this.pkeys = this.getPrimaryKeys();
Suggested Change:
if (this.upsert) this.pkeys = this.options.pkeys ? Promise.resolve(this.options.pkeys) : this.getPrimaryKeys();