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

Duplicate underscore in oneToMany #33

Open
Helveg opened this issue Aug 27, 2022 · 2 comments
Open

Duplicate underscore in oneToMany #33

Helveg opened this issue Aug 27, 2022 · 2 comments

Comments

@Helveg
Copy link

Helveg commented Aug 27, 2022

Using an entity with a column like this:

  @ManyToOne(() => Degree, { nullable: true })
  @JoinColumn()
  parentDegree?: Degree;

yields the column name parent_degree__id instead of parent_degree_id

@Jarreddebeer
Copy link

I suspect it could be because of the .concat('') in this line:

snakeCase(embeddedPrefixes.concat('').join('_')) +

since ['a'].concat('') results in ['a', '']; and then ['a', ''].join('_') results in 'a_'. So if like me you had {'prefix': 'a_'} the column name would end up 'a__id' not 'a_id'

@Helveg
Copy link
Author

Helveg commented Jan 19, 2024

Thanks. I will investigate

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

No branches or pull requests

2 participants