-
-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simplify table name generation #492
Comments
Strongly in favor of option 1. I don’t think the (very marginal) benefits of options 2 outweigh the downfalls. |
I agree with @mcdappdev. I customize all of my table names manually to fit me. Letting it generate it automatically is helpful, but doesn't add any benefit in my opinion. |
Also for option 1. If one wants to get fancy, they can still override the table name.
… On 24. May 2018, at 19:22, Jimmy McDermott ***@***.***> wrote:
Strongly in favor of option 1. I don’t think the (very marginal) benefits of options 2 outweigh the downfalls.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
The only winner in (2) is the grammar purist, and even then there is no One True Purity (persons vs people, fish vs fishes). Words whose plural is no change (sheep, deer). Words that have no plural (who, what). Model (1) is the sensible, almost surely right, path. But breaking change... is it not possible to reflect an existing entity's name into I suppose the only other option is to swap the (rather naïve) simple |
This seems strange to me. I like the default of adding the 's' as it's right more often than not, at least in my use cases. The one time it was wrong, I simply added the |
Currently, Fluent just adds an
s
to the end of the lowercased type name to generate table names. This has better performance than trying to generate correct plural forms of the words, but is obviously not correct in all cases. It is also not as performant as it could be since it requires lowercasing the type name. It is awkwardly in between being correct sometimes and being performant. I propose two different solutions:IMO, there's not a huge benefit to trying to transform the type name into a traditional SQL name. All strings in Fluent are escaped anyway. If we're being utilitarian, there's no reason to waste CPU resources generating "prettier" names you shouldn't have to interact with them directly anyway.
This would be a breaking change, but is easily remedied by implementing
static let entity: String
and would be much more performant.This would require quite a bit of work to get right--english is quite complex. Avoiding regex would be key. And ideally we would want to cache the result of the computation so that it doesn't affect performance. Although this is debatable since you could just implement the
static let entity: String
property if you wanted the extra performance. The key is implementing this is a nice, maintainable way.Thoughts?
The text was updated successfully, but these errors were encountered: