Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Model.associate adding new columns

Open
#1,353 0 comments 0 reactions 0 assignees View on GitHub

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
image
image

this worked with User because it has no associations but when I tried the products table I got an error
image
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sequelize/cli

All issues in sequelize/cli

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.