transporter icon indicating copy to clipboard operation
transporter copied to clipboard

Support updating existing records in postgres

Open craigedmunds opened this issue 8 years ago • 1 comments

When running a simple app, moving data from mongo to postgres, if there's a unique constraint, and records exist already, it ends up failing.

Update the postgres adapter to support the "ON CONFLICT DO UPDATE" syntax seems the best way to prevent this.

Have a basic implementation that needs refining (I'm not v proficient in Go!)

craigedmunds avatar Nov 11 '16 11:11 craigedmunds

The basic implementation:

  • Needs tests
  • Needs to act on primary keys not
  • Shouldn't be as noisy logging!
  • The idea of GenerateUpsertStatement is that it can be shared between update and insert, should refactor update

craigedmunds avatar Nov 11 '16 11:11 craigedmunds