2

I have this insert:

conn.insert(into: MyModel.self).values(rates).run()

Where MyModel conforms to PostgreSQLModel and rates is [MyModel]. I cannot grok the syntax for upsert which I have found solutions to here in the context of inserting multiple rows.

Thanks for any assistance.

mxcl
  • 26,392
  • 12
  • 99
  • 98
  • As FYI... Some time age, I looked for an `upsert` capability via SQLite flavor of Fluent. At that time, the Fluent `save(on: connection)` did not actually provide an `upsert` feature. See https://github.com/vapor/fluent-sqlite-driver/issues/23 Just added a Fluent "Feature Request: SQL MERGE (aka UPSERT) capability" here https://github.com/vapor/fluent/issues/640 – marc-medley Jul 18 '19 at 18:14

0 Answers0