Behaviour with auto-pluralization of tables differs from sequelize
See original GitHub issueTypically sequelize pluralises the model name to create tables, so that the table is called Users
and the model is called User
. That always made sense to me, since the table does contain multiple users.
By setting freezeTableName
to true
by default, sequelize-typescript
behaves differently from sequelize
in regards to the table names that are created. I tried to read up on https://github.com/RobinBuschmann/sequelize-typescript/issues/154 and https://github.com/RobinBuschmann/sequelize-typescript/pull/148 to understand why this was required, but I don’t think I understand… From the sequelize docs
About freezeTableName
:
If freezeTableName is true, sequelize will not try to alter the model name to get the table name. Otherwise, the model name will be pluralized
About underscoredAll
:
Converts camelCased model names to underscored table names if true. Will not change model name if freezeTableName is set to true
In particular I don’t understand what problem you’re referring to in this comment. I’ve just set freezeTableName
to false
in my own repository and so far things seem to work well. Was it that this would be a breaking change for sequelize-typescript
?
Would you consider such a breaking change (which will match the behaviour of sequelize more closely) for v1.0.0?
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (10 by maintainers)
It is already possible to set default define options for all tables like so
Nevertheless,
freezeTableName
is currently set while passing options via@Table
annotation instead of using the global default options 🙈My fault…@C45tr0 If you like to - Any help is appreciated