Reputation: 3439
I need to update one value in one row in my PostgreSQL DB through a simple Model.update() call.
It has always worked easily, but after updating to sequelize v4 it only updates column updatedAt (that's whats in logs), nothing more.
My code:
const updatedRow = await MyModel.update(
{name_of_column: "NEW VALUE"},
{
where: { id: SOME_ID_NUMBER },
raw: true,
returning: true,
}
);
I tried all possible combinations of properties raw/returning, even fields and attributes, but nothing is working. Thanks for your help.
Upvotes: 1
Views: 1382
Reputation: 1782
Unsure if this is it, but try switching raw: true,
for plain: true
.
The below comes from the upgrade to v4 docs.
"Getters wont run with instance.get({ raw: true })
, use instance.get({ plain: true })
"
Upvotes: 1