However, my question: how about the boolean fields in a database which titled as “is_aaabbcc”? I name them with “is_” because in a database I always do this with boolean fields. Then how would I go about that in Phoenix/Ecto?
schema "some_table" do
field :is_this_good, :boolean
There’s no support for naming it “this_good?”, right? Ecto doesn’t support that – a field must have the exact same name in a database and in a model, correct?
I showed you that :this_good? is not a problem, I told you as well that is_this_good is not a problem as well…
But maybe you wanted aliasing column names, which I am not a fan of… It makes things easier at first, but more complicated after everything has outgrown a certain size…
I had a lot of trouble to map faulty queries in the SQL log to actual code, because of those aliasing.
Uhh, I have an ancient oracle database that prepends every-single-tablename to every-single-fieldname. It is MUCH nice to refer to spbblh.id instead of spbblh.spbblh_id! And I have multiple hundreds (maybe over a thousand) of these columns that I have to talk with across multiple dozens of tables. o.O…
Believe me, it does not make things more complicated at a certain size as I doubt anyone in Elixir-land anywhere talks with a database as old or as massive as I do. It helps, a lot!
Okay that’s definitively a point for you. But in that legacy stuff I had to deal with the aliasing was without much sense. In the database I had a column ‘gehalt’ (German for salary, some people say Lohn as well) but it was aliases to ‘loan’ in the code…
The actual names were from a different domain, but all aliases were from German column and table names to more or less bad translated English words in code… The above is just an example from a domain most people do understand without further explanation
So do we want to agree on aliasing is a toll which rises or falls depending on the policies applied to it?
Eh maybe useful to english speakers but that is not a change I’d make. I keep the field names in mine (and a lot are entirely nonsensical things like spriden_sprinfaddr unless you know the weird acronyms in use, but I just remove the prepended table name is all.