Skip to content

Task 5267, Make all association to prefer as their foreign key name - #5957

Merged
janmeier merged 3 commits into
sequelize:masterfrom
sushantdhiman:task-5267
May 28, 2016
Merged

janmeier merged 3 commits into
sequelize:masterfrom
sushantdhiman:task-5267

Conversation

@sushantdhiman

Copy link
Copy Markdown
Contributor

Pull Request check-list

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does your issue contain a link to existing 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?

Description of change

Closes #5267

cc @mickhansen , @janmeier

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),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@janmeier

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@janmeier ping

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pong

I don't think we should try being smart, lets just use as literally

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we can merge it :)

@janmeier

Copy link
Copy Markdown
Member

@sushantdhiman All other dialects bug sqlite is failing

@sushantdhiman

Copy link
Copy Markdown
Contributor Author

Let me fix that :)

@sushantdhiman

Copy link
Copy Markdown
Contributor Author

@janmeier will this branch have to wait for #5924

@janmeier

Copy link
Copy Markdown
Member

#5924 is merged, so no :)

@sushantdhiman

Copy link
Copy Markdown
Contributor Author

Oh I was so close, need to rebase again I think :)

@sushantdhiman

Copy link
Copy Markdown
Contributor Author

@sushantdhiman

Copy link
Copy Markdown
Contributor Author

@janmeier you broke my build 😆 , need to rebase again

@janmeier

Copy link
Copy Markdown
Member

Yeah sorry, I forget to lint sometimes as well :(

@sushantdhiman

Copy link
Copy Markdown
Contributor Author

Finally done 😯 , Please merge @janmeier

@janmeier
janmeier merged commit 2b1657c into sequelize:master May 28, 2016
@janmeier

Copy link
Copy Markdown
Member

Done, thanks! :))

@sushantdhiman
sushantdhiman deleted the task-5267 branch May 28, 2016 09:52
@mickhansen

mickhansen commented May 30, 2016 •

Copy link
Copy Markdown
Contributor

@janmeier What ended up being the decision for ?:M?
(edit: nvm, found the comment)

overlookmotel added a commit to overlookmotel/sequelize that referenced this pull request Jun 14, 2016
overlookmotel added a commit to overlookmotel/sequelize that referenced this pull request Jun 14, 2016
overlookmotel added a commit to overlookmotel/sequelize that referenced this pull request Jun 14, 2016
overlookmotel added a commit to overlookmotel/sequelize that referenced this pull request Jun 19, 2016
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.

3 participants