Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong naming case for eager associations #17138

Closed
3 of 6 tasks
Kwaay opened this issue Mar 3, 2024 · 2 comments
Closed
3 of 6 tasks

Wrong naming case for eager associations #17138

Kwaay opened this issue Mar 3, 2024 · 2 comments
Labels
pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet type: bug

Comments

@Kwaay
Copy link

Kwaay commented Mar 3, 2024

Issue Creation Checklist

  • I understand that my issue will be automatically closed if I don't fill in the requested information
  • I have read the contribution guidelines

Bug Description

When we set relations between two models and child naming case is uppercase, then the eager loading doesn't create the proper name for the property since 7.0.0-alpha.36.
I tested in 7.0.0-alpha.35 and this issue wasn't there so it has been introduced since 7.0.0-alpha.36.
That's database agnostic.

Reproducible Example

Let say we have a parent model FOO and a child model BAR.
Then we configure relationship with hasMany and belongsTo

Here is the link to the SSCCE for this issue: here

What do you expect to happen?

If we fetch the parent model with eager loading, we should see child instances under the BARs property

Example: (child model is ACV) :
image

What is actually happening?

If we fetch the parent model with eager loading, we can see child instances under the bARs property

Example: (child model is ACV) :
image

Environment

  • Sequelize version: 7.0.0-alpha.36
  • Node.js version: 20.11.1
  • If TypeScript related: TypeScript version: X
  • Database & Version: mysql | Ver 15.1 Distrib 10.11.6-MariaDB, for debian-linux-gnu (x86_64)
  • Connector library & Version: mysql2 | 3.1.2

Would you be willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time and I know how to start.
  • Yes, I have the time but I will need guidance.
  • No, I don't have the time, but my company or I are supporting Sequelize through donations on OpenCollective.
  • No, I don't have the time, and I understand that I will need to wait until someone from the community or maintainers is interested in resolving my issue.

Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.

@Kwaay Kwaay added pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet type: bug labels Mar 3, 2024
@ephys
Copy link
Member

ephys commented Mar 18, 2024

In our conventions, we consider attributes and associations to be class properties, and therefore recommend naming them in lowerCamelCase. We also generate the default names in lowerCamelCase.

You can customize your association name using the as option. If you use the class-based definition, it will automatically use the name of the property: https://sequelize.org/docs/v7/associations/has-one/#defining-the-association

@ephys
Copy link
Member

ephys commented Mar 26, 2024

As I don't see anything we can change on our end, I will close this issue

@ephys ephys closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet type: bug
Projects
None yet
Development

No branches or pull requests

2 participants