Column name problem. #1283
-
I have created a table with some fields. I have generate a modal for it. But I have facing a problem with column name, its return me in snake_case. How to avoid this? @column({ columnName: 'countryCode' })
public countryCode: number it's return "country_code" but my expectation is "countryCode". |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @pk4all! 👋 This is normal since we are following SQL convention (where your column should be Inside the orm: {
getSerializeAsKey(_, key) {
return key;
},
}, |
Beta Was this translation helpful? Give feedback.
Hey @pk4all! 👋
This is normal since we are following SQL convention (where your column should be
snake_case
).If you want to bypass this, you can freely change the behavior of our serializer to not mutate the column name.
Inside the
config/database.ts
file, you need to overide thegetSerializeAsKey
method.