Hello,
We have noticed a problem with model associations occurring in all our environments that we did not have before the forest-express-sequelize 7.9.4 update.
Expected behavior
Before the upgrade to forest-express-sequelize 7.9.4
When an attribute value was modified in a model that had another association, the model that was called was called.
To illustrate this, let’s take an example:
A company model associated with an employees model
Let’s imagine that I want to change the first name of the employee by going through the company model first
company → Alexandre’s company-> employees → Alexandre Pape
If I change the first name of this one will only update the employees model of Alexandre Pape
company → Alexandre’s company-> employees → (save)
Actual behavior
With the upgrade to forest-express-sequelize 7.9.4
If I take my example.
Currently if I change the first name it will update the employee model Alexandre Pape + save the Alexandre’s company.
When I print the SQL logs, Forest calls all the associations of the model in question and saves them.
company → Alexandre’s company-> employees → Alexandre Pape
company → (save) → employees → (save)
When I go through a service, endpoint of employees database, it calls only the employees model.
We’ve seen this in custom events called in beforesave() hooks. Which was not called on the par before.
Context
Please provide any relevant information about your setup.
- Package Version: 6.14.6
- Sequelize Version: 6.3.5
- Database Dialect: PostgreSQL
- Database Version: 10
- Project Name: Homeloop