question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

underscoredAll option not overriding underscored option

See original GitHub issue

I’d expect underscored to be set to true when underscoredAll is set to true, but this is not happening. Code was written in order to support this, but the code was written incorrectly. I’m talking about the following line of code:

this.underscored = this.underscored || this.underscoredAll;

Which is located in the following places in the following versions: V4: https://github.com/sequelize/sequelize/blob/master/lib/model.js#L761 V3: https://github.com/sequelize/sequelize/blob/v3/lib/model.js#L56 V2: https://github.com/sequelize/sequelize/blob/2.0/lib/model.js#L52

As you can see, it’s trying to set this.underscored and is evaluating this.underscored and this.underscoredAll. It’s supposed to be this.options.* though, as that’s where those two options are located. Currently this line of code has no result.

Could someone confirm if underscoredAll: true should result in underscored being set to true or not?

I’d be willing to make the pull request if it’s supposed to work like this.

Dialect: any Database version: any Sequelize version: 2.x, 3.x & 4.x

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:24 (22 by maintainers)

github_iconTop GitHub Comments

1reaction
Rovackcommented, Feb 8, 2018

The discussion here seemed to have had some really good ideas, that would have avoided a lot of confusion. Sad to see this seemingly closed without any actual results.

0reactions
sousergecommented, Aug 30, 2018

The docs still say that underscored affects all camelCased columns, while in fact it does not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sequelize v5 underscored option is not working - Stack Overflow
Recently migrated to sequelize v5 for using typescript. So I removed "underscoredAll" option because it is no more supported on sequelize v5.
Read more >
Naming Strategies - Sequelize
Without the underscored option, Sequelize would automatically define: A createdAt attribute for each model, pointing to a column named createdAt in each table ......
Read more >
Sequelize underscored option not functioning as expected ...
I'm guessing v4 or earlier; the underscored option only applies to property / column names on v5 or newer. In Sequelize v4, the...
Read more >
sequelize-hierarchy - UNPKG
118, * Fix: Allow `underscored: false` option on model to override global option. 119, * Fix: `rebuildHierarchy` support custom primary keys.
Read more >
sequelize-hierarchy-fork - npm
Model#isHierarchy( [options] ) · Adds a column parentId to Folder model · Adds a column hierarchyLevel to Folder model (which should not be ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found