underscore / camelcase option should control all fields and table name generation
See original GitHub issueIt would be great if sequelize will generate PostgreSQL DDL with lower_case_underscored table name and column names. By now underscore option manage foreign keys and create_at, modifed_at fields only.
In short
CREATE TABLE IF NOT EXISTS "Male" ("CamelCase" VARCHAR(255), "created_at" TIMESTAMP WITH TIME ZONE NOT NULL, "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL);
should become
CREATE TABLE IF NOT EXISTS male (camel_case VARCHAR(255), "created_at" TIMESTAMP WITH TIME ZONE NOT NULL, "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL);
my global config is
{
"username": "",
"password": "",
"database": "",
"host": "127.0.0.1",
"dialect": "postgres",
"define":{
"paranoid":false,
"timestamps":true,
"freezeTableName": true,
"underscored": true
}
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:50
- Comments:54 (12 by maintainers)
Top Results From Across the Web
Table Naming: Underscore vs Camelcase? namespaces ...
So mapping table columns(camelCase) and json object names(camelCase) to these properties can result in error(because mapping is case sensitive).
Read more >Why does Oracle still not support camelcase table and column ...
Oracle's lack of support for camelcase table and column names has been a pain in my backside for far too long.
Read more >Define Naming Rules Dialog - Documentation - Telerik
Usually this "Interpret underscore as word delimiter" option is used together with the CamelCase or PascalCase modes where each word in the name,...
Read more >Names in the underlying database - Prisma
So if a model is remapped to a different name in the data model, the default name generation will still take the name...
Read more >How to customize property names and values with System ...
Customize individual property names; Use camel case for all JSON property names ... To set the name of individual properties, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t think this is needed - If users want underscored names, they can simply define them as such, or use the
field
option.The
underscored
option is for controlling auto-generated column names, but when a user tells us about the columnfooBar
, we call it fooBar 😉This can easily be solved with a
beforeDefine
hookIt took me a long time to figure out why
underscored
option didn’t convert mycamelCase
column names tounder_scored
ones.I would also prefer to declare my columns as
camelCased
ones to be automatically converted later to underscored ones in SQL.