* @override
(tableName, insertValues, updateValues, where, options)
| 42 | * @override |
| 43 | */ |
| 44 | async upsert(tableName, insertValues, updateValues, where, options) { |
| 45 | options = { ...options }; |
| 46 | |
| 47 | options.type = QueryTypes.UPSERT; |
| 48 | options.updateOnDuplicate = Object.keys(updateValues); |
| 49 | options.upsertKeys = Object.values(options.model.primaryKeys).map(item => item.field); |
| 50 | |
| 51 | const model = options.model; |
| 52 | const sql = this.queryGenerator.insertQuery(tableName, insertValues, model.rawAttributes, options); |
| 53 | return await this.sequelize.query(sql, options); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * @override |
nothing calls this directly
no test coverage detected