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
It seems when using variable as a way to reduce code lines it causes problem for sequelize.
Reproducible Example
Here is the link to the SSCCE for this issue:
exportdefaultclassMyModelextendsModel{staticinit(sequelize){constrepeatedDefinition={type: Sequelize.INTEGER,defaultValue: 0,validate: {min: {args: [0],msg: 'Value should be between 0 and 7',},max: {args: [7],msg: 'Value should be between 0 and 7',},},};super.init({field1: repeatedDefinition,field2: repeatedDefinition,field3: repeatedDefinition,field4: repeatedDefinition,field5: repeatedDefinition,field6: repeatedDefinition,field7: repeatedDefinition,},{
sequelize,freezeTableName: true,tableName: 'myModels',});returnthis;}
What do you expect to happen?
Quicken table field definition by using a variable and allow less lines of code.
What is actually happening?
It seems it confuses the fields in someway. I realized that when sending two fields with different values, it set one of the values to all other fields. Like
mymodel.update({field1: 4, field2: 2})
Expected this to update only field 1 and 2, but
field1 = 4 // Correct
field2 = 2 // Correct
field(3 to 7) = either 2 or 4 // Sometimes one, sometimes the other
Environment
To find the version numbers for the three systems below use the following commands:
sequelize@6.27.0
v18.12.0
Javascript
MySQL 8.0.31
mysql2 "^2.3.3"
Would you be willing to resolve this issue by submitting a Pull Request?
[X ] 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.
The text was updated successfully, but these errors were encountered:
ephys
added
v6
and removed
pending-approval
Bug reports that have not been verified yet, or feature requests that have not been accepted yet
labels
Dec 27, 2022
I can confirm this bug exists in v6, but was fixed in @sequelize/core@^7.0.0-alpha.20. I don't know if it's possible to fix in Sequelize 6 unfortunately. The design flaw that caused this issue required introducing a breaking change
Issue Creation Checklist
Bug Description
It seems when using variable as a way to reduce code lines it causes problem for sequelize.
Reproducible Example
Here is the link to the SSCCE for this issue:
What do you expect to happen?
Quicken table field definition by using a variable and allow less lines of code.
What is actually happening?
It seems it confuses the fields in someway. I realized that when sending two fields with different values, it set one of the values to all other fields. Like
mymodel.update({field1: 4, field2: 2})
Expected this to update only field 1 and 2, but
field1 = 4 // Correct
field2 = 2 // Correct
field(3 to 7) = either 2 or 4 // Sometimes one, sometimes the other
Environment
To find the version numbers for the three systems below use the following commands:
Would you be willing to resolve this issue by submitting a Pull Request?
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
The text was updated successfully, but these errors were encountered: