Repository navigation
Task 5267, Make all association to prefer as their foreign key name - #5957
Conversation
| this.foreignKey = this.options.foreignKey || Utils.camelizeIf( | ||
| [ | ||
| Utils.underscoredIf(this.source.options.name.singular, this.source.options.underscored), | ||
| Utils.underscoredIf(this.options.as || this.source.options.name.singular, this.source.options.underscored), |
There was a problem hiding this comment.
Should this be the singular name of the alias? WorkersId is pretty ugly, but we could run into a lot of issues like we've done previously.
There was a problem hiding this comment.
Original behavior for as require us to use the as field entirely. If we change it to N:M, we have to change it to 1:N as well?
There was a problem hiding this comment.
Yes it would be for both ?:M.
I'm not certain it's a good idea, but it basically forces users to define foreignKey every time they define as, which is probably not a bad idea but.
There was a problem hiding this comment.
Pong
I don't think we should try being smart, lets just use as literally
There was a problem hiding this comment.
Then we can merge it :)
|
@sushantdhiman All other dialects bug sqlite is failing |
|
Let me fix that :) |
|
#5924 is merged, so no :) |
|
Oh I was so close, need to rebase again I think :) |
|
@janmeier can you restart https://travis-ci.org/sequelize/sequelize/builds/133558506 build, its stuck |
|
@janmeier you broke my build 😆 , need to rebase again |
|
Yeah sorry, I forget to lint sometimes as well :( |
|
Finally done 😯 , Please merge @janmeier |
|
Done, thanks! :)) |
|
@janmeier What ended up being the decision for ?:M? |
Pull Request check-list
npm run testornpm run test-DIALECTpass with this change (including linting)?Futurein the changelog?Description of change
Closes #5267
hasOnehttps://github.com/sequelize/sequelize/blob/master/lib/associations/has-one.js#L50belongsTohttps://github.com/sequelize/sequelize/blob/master/lib/associations/belongs-to.js#L50hasManyhttps://github.com/sequelize/sequelize/blob/master/lib/associations/has-many.js#L75belongsToManyhttps://github.com/sequelize/sequelize/blob/master/lib/associations/belongs-to-many.js#L116cc @mickhansen , @janmeier