Use RETURNING * when doing update queries in postgres.
This gives better results when doing an update so you don't run into issues where you did something like: mymodel.myfield = 'foo' mymodel.save(theseParams) mymodel.myfield of course wasn't updated, but it will appear to a test perhaps that it was. This will also allow the attributes that are returned to behave the same as they would in an insert or a select query. To see this try creating an ARRAY column type in postgres, then make it a text field in sequelize. The value that will be returned is the same on the type for insert/select but not for update.
Showing
with
17 additions
and
11 deletions
-
Please register or sign in to post a comment