You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When model.save() triggers a hook that updates an instance STRING value, Sequelize does not apply this to database. The resulting query does not attempt to update this field.
However, Sequelize does update the javascript model instance.
This is extremely misleading at best: the app believes the database field has been updated, when actually the database field has not changed.
NB: Some of the test executions "pass", but it looks like that is only because the SSCCE repo is sometimes running dummy tests instead of the real SSCCE code.
What do you expect to happen?
If a hook fires and includes code to update a field, the field should be updated and that update should be persisted to the database via the UPDATE query.
OR: at the very least, the model instance should remain consistent with Sequelize-facilitated database updates. The instance should never stay divergent after .save(), as it does in the SCCE.
What is actually happening?
When using:
at least STRING datatypes, and
beforeValidate or beforeUpdate hooks,
The field is not updated in the database (UPDATE query does not include the hook-generated update). But the sequelize instance is updated.
Additional context
Add any other context or screenshots about the feature request here.
Environment
Sequelize version: 6.3.3
Node.js version: 12.20.0
Operating System: docker-alpine, running on Mac OS Big Sur 11.1
Issue Template Checklist
How does this problem relate to dialects?
I think this problem happens regardless of the dialect.
I think this problem happens only for the following dialect(s):
I don't know, I was using PUT-YOUR-DIALECT-HERE, with connector library version XXX and database version XXX
The SSCCE testing results show mixed failures and it is unclear which of these (if any) really reflect dialect differences or just issues with the SSCCE repo.
Would you be willing to resolve this issue by submitting a Pull Request?
Yes, I have the time and I know how to start.
[] Yes, I have the time but I don't know how to start, I would need guidance.
No, I don't have the time, although I believe I could do it if I had the time...
No, I don't have the time and I wouldn't even know how to start.
This SSCCE is about the limits of my ability, sorry.
The text was updated successfully, but these errors were encountered:
Issue Description
When model.save() triggers a hook that updates an instance STRING value, Sequelize does not apply this to database. The resulting query does not attempt to update this field.
However, Sequelize does update the javascript model instance.
This is extremely misleading at best: the app believes the database field has been updated, when actually the database field has not changed.
What are you doing?
Here is the link to the SSCCE for this issue: sequelize/sequelize-sscce#154
NB: Some of the test executions "pass", but it looks like that is only because the SSCCE repo is sometimes running dummy tests instead of the real SSCCE code.
What do you expect to happen?
If a hook fires and includes code to update a field, the field should be updated and that update should be persisted to the database via the UPDATE query.
OR: at the very least, the model instance should remain consistent with Sequelize-facilitated database updates. The instance should never stay divergent after
.save()
, as it does in the SCCE.What is actually happening?
When using:
The field is not updated in the database (UPDATE query does not include the hook-generated update). But the sequelize instance is updated.
Additional context
Add any other context or screenshots about the feature request here.
Environment
Issue Template Checklist
How does this problem relate to dialects?
The SSCCE testing results show mixed failures and it is unclear which of these (if any) really reflect dialect differences or just issues with the SSCCE repo.
Would you be willing to resolve this issue by submitting a Pull Request?
This SSCCE is about the limits of my ability, sorry.
The text was updated successfully, but these errors were encountered: