Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special method/mixin "add" for BelongsToMany association overrides record instead of creating a new one #16984

Open
3 of 6 tasks
rdsedmundo opened this issue Jan 23, 2024 · 0 comments
Labels
pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet type: bug

Comments

@rdsedmundo
Copy link

rdsedmundo commented Jan 23, 2024

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

Reproducible Example

Here is the link to the SSCCE for this issue: rdsedmundo/20240123-sequelize-add-mixin-method-bug@af84fd6

What do you expect to happen?

A new record should have been created, especially because another field of the junction table is passed—although to be honest in any case I think I'd expect what is happening without an unique constraint being defined.

Setting through.unique to false doesn't change anything.

What is actually happening?

The third test is executing this:

[Sequelize] Executed (default): UPDATE FooBarAttachments SET restrictionId=$1 WHERE fooName = $2 AND barName = $3; {"$1":3,"$2":"TS foo","$3":"TS bar"} [Elapsed time: 0 ms]

Environment

  • Sequelize version: 6.11.0
  • Node.js version: 20.9.0
  • If TypeScript related: TypeScript version: 5.1.6
  • Database & Version: Postgres 16.1
  • Connector library & Version: 8.9.0

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.

@rdsedmundo rdsedmundo added pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet type: bug labels Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet type: bug
Projects
None yet
Development

No branches or pull requests

1 participant