sequelize / sequelize/sequelize
Deduping of belongsToMany associations
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 30.4k
- Forks
- 4.3k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 68
Description
I have tried to discuss this on the Slack channel but didn't get much response. I am aware of the on-going issue where belongsToMany-association with a custom unique index is not supported. I would like to make a change were it checks if the through-table has a custom unique index (other then the two foreign keys) and if so check disable the deduping of the items. Only I am have been trying to find the code which does the deduping but I haven't been able to find it.
If the maintainers of this library find my idea mentioned above feasible (worth a PR) would you be able to point to the right parts of the code base? Thank you!
If you use raw: true the deduping is disabled, so it has to be somewhere around there. Does Sequelize have a helper method to convert the raw output in the model fields?
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
The issue names belongsToMany associations, the through table, and raw: true, but no file or test. Start by tracing where normal query results are deduplicated versus raw results; done means a custom unique index on the through table prevents that deduplication while raw behavior remains understood.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100