sequelize / sequelize/sequelize
The return values of the update function (object '_previousDataValues' and 'dataValues') seems incorrect.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 30.4k
- Forks
- 4.3k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 68
Description
Issue Creation Checklist
- I understand that my issue will be automatically closed if I don't fill in the requested information
- I have read the contribution guidelines
Bug Description
After changing the data using the UPDATE function with returning and plain set to true, the return data _previousDataValues and dataValues shows the same data, and not the data before and after the update.
Reproducible Example
What do you expect to happen?
The object _previousDataValues should contain the value before the update.
In my exemple, the console.logs (of title) should show different values (before and after update)
What is actually happening?
The object _previousDataValues shows the same values as the object dataValues and those are the new value after the update.
In my exemple, the console.logs (of title) should show the same values
Environment
- Sequelize version: sequelize@6.35.2
- Node.js version: v20.18.1
- If TypeScript related: TypeScript version: Using javascript
- Database & Version: PostgreSQL
- Connector library & Version: pg
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 will need guidance.
- No, I don't have the time, but my company or I are supporting Sequelize through donations on OpenCollective.
- No, I don't have the time, and I understand that I will need to wait until someone from the community or maintainers is interested in resolving my issue.
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with Sequelize 6.35.2 on Node.js 20.18.1 using PostgreSQL and the pg connector, calling the update function with returning and plain set to true. Inspect the update path and verify that the returned object's _previousDataValues retains the old title while dataValues contains the new title.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, postgresql, typescript
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100