disable snake case mapping for specific columns #2671
Unanswered
mickeyambrosius
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
Having some issues on snake case mapping. I use an npm library where some column names by default defined as snakeCase but all other columns in my db is snake_case. I use the knexSnakecaseMapper which works but when joining a table having the
table generated from npm
{
id: xxxx,
someField: '123',
anotherField: '455',
field_added_by_my_migration: 'test'
}
when joining on that table the generated sql ends up trying to include "someField" as "some_field" and "another_field" as "anotherField" because of the mapper. So what is the best approach here? Is it possible to tell objection to not snake case map specific fields? or somehow force the naming of specific columns. I've looked into columnNameMappers but can't really figure it out
For now I solved it by filtering out the columns, but would be nice with a more permanent solution (besides restructuring everything in the database :)
Thanks
Beta Was this translation helpful? Give feedback.
All reactions