Skip to content

fix(model): check attributes specified for included through model#12316

Merged
sushantdhiman merged 1 commit into
sequelize:masterfrom
aristov:port/fix/include-through-attributes
May 26, 2020
Merged

fix(model): check attributes specified for included through model#12316
sushantdhiman merged 1 commit into
sequelize:masterfrom
aristov:port/fix/include-through-attributes

Conversation

@aristov

@aristov aristov commented May 26, 2020

Copy link
Copy Markdown
Contributor

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you update the typescript typings accordingly (if applicable)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

Project.belongsToMany(User, { through : 'UserProject' })
User.belongsToMany(Project, { through : 'UserProject' })

User.findAll({
  include : [
    {
      model : Project,
      through : {
        attributes : [] // the option is fixed by this change
      }
    }
  ]
})

This PR is a port of the #12020 to master branch.

@codecov

codecov Bot commented May 26, 2020

Copy link
Copy Markdown

Codecov Report

Merging #12316 into master will increase coverage by 3.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12316      +/-   ##
==========================================
+ Coverage   93.37%   96.40%   +3.02%     
==========================================
  Files          91       95       +4     
  Lines        8753     9115     +362     
==========================================
+ Hits         8173     8787     +614     
+ Misses        580      328     -252     
Impacted Files Coverage Δ
lib/model.js 96.62% <100.00%> (+<0.01%) ⬆️
lib/dialects/sqlite/index.js 100.00% <0.00%> (ø)
lib/dialects/sqlite/query.js 98.18% <0.00%> (ø)
lib/dialects/sqlite/query-interface.js 98.55% <0.00%> (ø)
lib/dialects/sqlite/connection-manager.js 100.00% <0.00%> (ø)
lib/dialects/abstract/query-interface.js 93.76% <0.00%> (+0.31%) ⬆️
lib/data-types.js 91.37% <0.00%> (+0.34%) ⬆️
lib/dialects/abstract/query-generator.js 97.39% <0.00%> (+0.50%) ⬆️
lib/dialects/abstract/query.js 91.98% <0.00%> (+0.96%) ⬆️
lib/sequelize.js 95.81% <0.00%> (+1.28%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d87cc5...f0aeaf7. Read the comment docs.

@sushantdhiman
sushantdhiman merged commit 59b8a7b into sequelize:master May 26, 2020
@papb

papb commented May 26, 2020

Copy link
Copy Markdown
Member

Thank you very much!! 🚀

@Leithal3

Copy link
Copy Markdown
Contributor

Hey @papb, just wondering when you guys are planning the next release to v6? This is something I would like to use.

I realise there was a release around a week ago so no pressure 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants