-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Before naming convention was introduced, adding prefix and suffix was pretty straightforward.
For example, say I have a table called foo then HGE generated field names such as foo, foo_by_pk, etc. Now if I want to add prefix while retaining the snakecase of the fields, I would add prefix my_prefix_ and suffix _my_suffix and thus the new field names will be my_prefix_foo_my_suffix, my_prefix_foo_by_pk_my_suffix, etc. (Please note that this is the case with hasura-default naming convention)
With the introduction of graphql-default naming convention, there is no way to add prefix and still retain the case of the field name. For example, if I have a table named foo, the field names generated are foo, fooByPk, etc. Now if I want to add some prefix, say myPrefix, the new fields will be myPrefixfoo, myPrefixfooByPk, etc.
This raises a few questions:
- Should hasura change the already generated field names when someone adds a prefix or suffix? i.e. should hasura generate
myPrefixFoo,myPrefixFooByPk, etc. in the above example. - If yes, then to be consistent shouldn't hasura also add
_automatically when adding prefix and suffix forhasura-default?
PS: There is a really dirty workaround to fix the prefixing issue by renaming the table to oo and adding prefix myPrefixF, but I don't think anyone should do this.