[CamelCasePlugin] underscore might added twice when underscoreBeforeDigits
is set to true
globally
#1281
Labels
underscoreBeforeDigits
is set to true
globally
#1281
Given:
I have a PostgreSQL database that has some columns with underscores before the digits, i.e.:
and I have configured Kysely DB to use
CamelCasePlugin
and I have set
CamelCasePlugin
options to use{ underscoreBeforeDigits: true }
(so that working with columns that have an underscore + digit, such asaddress_row_1
, would not cause any errors)When:
I select from a subquery
Then:
Actual behavior:
addressRow1
becomesaddress_row__1
in a final SQL, thus resulting in an error, because such a column does not exist (I think becausecreateSnakeCaseMapper
executes conversion twice)Expected behavior:
addressRow1
becomesaddress_row_1
in a final SQL resulting in no errorsSteps to reproduce:
In
Kysely
repository, incamel-case.test.ts
, add this test, run it and see that it's failing:camel-case.test.ts
As a workaround, these lines could be uncommented to pass the test and get the desired output/behavior, but that doesn't really feel right to me because
CamelCasePlugin
gets instantiated several times instead of one:So my question is: is this really a bug(when
SelectQueryBuilder
selects from anotherSelectQueryBuilder
), or the workaround I found is the actual way to go?The text was updated successfully, but these errors were encountered: