Skip to content

V3 Fix sourceKey for hasMany, issue: #4258 - #6652

Merged
janmeier merged 10 commits into
sequelize:v3from
Paxa:v3
Jan 24, 2017
Merged

janmeier merged 10 commits into
sequelize:v3from
Paxa:v3

Conversation

@Paxa

@Paxa Paxa commented Sep 30, 2016 •

Copy link
Copy Markdown

Thanks for wanting to fix something on Sequelize - we already love you long time! Please delete this text and fill in the template below. If unsure about something, just do as best as you're able.

If your PR only contains changes to documentation, you may skip the template below.

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 your issue contain a link to 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)?
  • Have you added an entry under Future in the changelog?

NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.

Description of change

Please provide a description of the change here.

Closes #4258

stellasoft-will and others added 3 commits April 29, 2016 14:08
added a source key field to allow the source table to have a custom
foreign key that is not primary, defaults to the primary if not given
@Paxa Paxa changed the title V3 Fix sourceKey for hasMany (WIP) V3 Fix sourceKey for hasMany, issue: #4258 (WIP) Sep 30, 2016
@codecov-io

codecov-io commented Sep 30, 2016 •

Copy link
Copy Markdown

Current coverage is 93.85% (diff: 100%)

Merging #6652 into v3 will decrease coverage by 0.14%

Powered by Codecov. Last update 446b3d0...2675a77

@Paxa

Paxa commented Oct 10, 2016

Copy link
Copy Markdown
Author

Any chance it got accepted?

@felixfbecker

Copy link
Copy Markdown
Contributor

It's still labeled as WIP? Also, tests are failing. Could you link the PR this is a backport for?

@Paxa Paxa changed the title V3 Fix sourceKey for hasMany, issue: #4258 (WIP) V3 Fix sourceKey for hasMany, issue: #4258 Oct 10, 2016
@Paxa

Paxa commented Oct 10, 2016

Copy link
Copy Markdown
Author

@felixfbecker tests passed this time
Sorry forgot to remove WIP

@sushantdhiman sushantdhiman removed the wip label Oct 10, 2016
@sushantdhiman

Copy link
Copy Markdown
Contributor

@Paxa Please link or create the PR which add this fix to master as well. Only then we can merge this change to v3 :)

@garrypolley

garrypolley commented Oct 12, 2016 •

Copy link
Copy Markdown
Contributor

I may be misusing this PR.

Should this work when using an include? Given the example, I am attempting a query where I basically do:

CountryModel(where={somestuff}, include=[{model: CityModel, where: {somecase}}])

It still seems to be querying on the primary key in this case. (it's possible my syntax is off above, but that is essentially what's happening in the end).

The key they join on between my models is the same on both models. If I change it to a different sourceKey it uses the different one, but as soon as they use the same key it defaults back to the id field.

@Paxa

Paxa commented Nov 28, 2016

Copy link
Copy Markdown
Author

Can anybody help me with this please?

@felixfbecker

Copy link
Copy Markdown
Contributor

Is there a PR to master? Need that first before you can do a backport

@twolfson twolfson mentioned this pull request Jan 16, 2017
5 tasks done
@twolfson

Copy link
Copy Markdown
Contributor

I have ported the changes over to master and opened a PR here:

#7113

@LoneWolfPR

Copy link
Copy Markdown
Contributor

So, am I misreading this or is this basically ready to go into V3 except for a merge conflict in changelog.md?

@janmeier
janmeier merged commit a3d2262 into sequelize:v3 Jan 24, 2017
@janmeier

Copy link
Copy Markdown
Member

You are correct, thanks for bringing it up @LoneWolfPR :)

Published in v3.30.0 🎉

@Paxa

Paxa commented Jan 24, 2017

Copy link
Copy Markdown
Author

Thank you

@LoneWolfPR

Copy link
Copy Markdown
Contributor

A million times thank you! This has made my life so much easier!

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.

8 participants