sequelize / sequelize/sequelize

BeforeBulkUpdate hook for increment/decrement

Open
#16,637 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
30.4k
Forks
4.3k
Avg merge
1d 6h
Merged PRs (30d)
68

Description

Feature Description

Describe the feature you'd like to see implemented

Right now beforeBulkUpdate hook is called for Model.update but not for Model.increment/decrement.
It would be useful to call the hook in case of these methods too.

Describe why you would like this feature to be added to Sequelize

My case. I need to use this hook to populate the tenant_id field of my model. It is more convenient to set a value in a model hook and not to set a value manually in different pieces of code.
I don't see a problem here with atomic update.

Is this feature dialect-specific?
  • No. This feature is relevant to Sequelize as a whole.
Would you be willing to resolve this issue by submitting a Pull Request?
  • 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 implementing my feature.

Indicate your interest in the addition of this feature by adding the 👍 reaction. Comments such as "+1" will be removed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the beforeBulkUpdate hook entry point and the Model.increment/decrement methods described in the issue. Confirm how Model.update invokes the hook, then add equivalent behavior for increment and decrement and verify that the hook runs while preserving atomic updates.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
backend, database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.