Skip to content

Commit

Permalink
fix(mysql): fix mysql update
Browse files Browse the repository at this point in the history
returning() is not supported by mysql or mysql2 and will not have any effect, update only return 1
to true or 0 to false. So update method was changed to return only true or false if driver is mysql

re #32
  • Loading branch information
jhomarolo committed Oct 18, 2021
1 parent 21cd1b5 commit d3250c4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ module.exports = class Repository {
.returning(fields)
.update(payload)

//.returning() is not supported by mysql or mysql2 and will not have any effect, update only return 1 to true or 0 to false
if(this.knex.client.driverName.includes('mysql'))
return ret === 1

return this.dataMapper.toEntity(ret[0])
}

Expand Down

0 comments on commit d3250c4

Please sign in to comment.