Open toastal opened 2 months ago
I attempted to use something like
def :: ImplicitIdDef
def =
autoIncrementingInteger
{ iidFieldType =
\entName ->
FTTypeCon Nothing $ unEntityNameHS entName `mappend` "ID"
}
to no avail to fix the situation.
What I have not tried: sed -i "s/Id/ID/g" **/*.hs
& seen if everything works.
Yeah, that assumption is baked into a lot of the TH code. I don't anticipate changing that to be easy or particularly flexible.
Is there a combinator route to go, or is Template Haskell the only/preferred way?
While you can define the PersistEntity
stuff yourself, it's not really easy or well-supported.
All implicit generated IDs such as the ID for
Foo
is generated asFooId
. While much of the documentation uses “ID”, the code representation is incorrect casing where “ID” is the standard abbreviation form for identifiers (IDs), not “Id”. Changing this would align other correctly-cased variables in the project likeDB
(along with uses ofIO
,UUID
, &FromJSON
from other libs), but still leaves incorrect cases likeSql
instead ofSQL
for the initialism ‘structured query language’ (where documentation is largely using “SQL”).What I would expect is the implicit ID for
Foo
becomesFooID
… allfooId
columns becomefooID
.Moving from ‘ID’ to ‘Id’ is losing valuable casing information & if it weren’t important, we wouldn’t be bothering with upper case letters at all in English (& other languages with bicameral scripts).