Open MariuzM opened 3 months ago
Out of pure curiosity, I have been attempting to define a way to provide Kysely with aliases for column names, and also possibly for table names.
I have drizzle setup for a postgres database and I am using kysely for a mssql database, and I'm now using dremio to be able to do joins between the two databases and using Kysely to build the queries for dremio.
I'm able to construct the postgres tables using Kyselify, but not with the drizzle aliases. For clarity, I want the names in code to remain the same as when I'm using drizzle.
TLDR: A custom plugin for Kysely to provide aliases is in store. If I make headway on one, I will share it with the community.
EDIT: I took the time to look into making a plugin. The benefits of Kysely seem to also be its weakness in this case. The closest you can get is creating a transformer for ReferenceNode; however, the original table name of aliased tables in not included in the ReferenceNode. That's the missing link here is somehow gaining the context for aliased tables which would then allow you to search a provided alias map to the plugin for the table and column name.
When i use Kysely +
plugins: [new CamelCasePlugin()]
i get types that arecamelCase
, but when i also want to useKyselify
types are onlysnake_case
.Any chance to have support for camelCase when using with
plugins: [new CamelCasePlugin()]
?