Model.associate adding new columns
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript, mysql
- Domain
- database
Research direction
Start with the models/index.js entry point and the User and products model definitions, focusing on each belongsTo() association. Reproduce the issue against MySQL using the reported Sequelize CLI, Node, and ORM versions, then verify that loading products no longer selects columns absent from the models, migrations, or database.
Written by the indexing model from the issue text.
Description
What you are doing?
I wanted to access all models from a single file so I used the index.js file in the models directory and accessed them like so
this worked with User because it has no associations but when I tried the products table I got an error
the association added a new column for every belongsTo() call so now it's trying to select columns that aren't anywhere in my models, migration or database
Dialect: mysql
Sequelize CLI [Node: 18.12.0, CLI: 6.6.1, ORM: 6.32.1]
- Dominant language
- JavaScript
- Stars
- 2.6k
- Forks
- 524
- PR merge metrics
- No merged PRs in 30d
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.
More from sequelize/cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Similar issues
-
bug confirmed issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
open-webui/open-webui#30750 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Mend: dependency security vulnerability untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 70/100