Closed daniel-gato closed 1 week ago
This is an interesting idea. I would probably use pluralize for this.
I think, if this is implemented, we will sooner or later need a way to provide custom singularization rules as well. In that case, we might also need configuration capabilities as in #34.
Created a PR for this: https://github.com/RobinBlomberg/kysely-codegen/pull/162
Should be released in kysely-codegen@0.16.0! 🚀
Hi,
For context: It is quite common to have tables name in their plural form to describe what the table contains. This is the approach that Ruby on Rails takes as well. Our model Car, will be stored in a "cars" table.
Would it be possible to have a "singularise-entities" to turn:
into
The same way that camelCase works?
Another reason to do that is to avoid having mixed types with reserved table names.
User
table name is not allowed in PG for example. In the same example, from memory, mysql won't allow table names likeadmin
,backup
,channel
,action
Upvote & Fund