Skip to content

Commit

Permalink
Add conflict action to insert
Browse files Browse the repository at this point in the history
  • Loading branch information
pirttju authored Apr 2, 2024
1 parent 2dabeb3 commit c4e44d4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion db/repos/tsr.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class TSRRepository {
}

async insert_tsr(data) {
const query = this.pgp.helpers.insert(data, cs.nrod_tsr);
const query = this.pgp.helpers.insert(data, cs.nrod_tsr) +
" on conflict (tsr_batch_msg_id, tsrid) do update set " +
cs.nrod_tsr.assignColumns({from: 'excluded', skip: ["tsr_batch_msg_id", "tsrid"]});
return this.db.none(query);
}
}
Expand Down

0 comments on commit c4e44d4

Please sign in to comment.