3 ms·
> The primary key column is named id or thing_id or thingId, where thing is the singular form of the table name. Is it naming relations a plural word a common
by ElectricalUnion 3y ago
> The primary key column is named id or thing_id or thingId, where thing is the singular form of the table name.
Is it naming relations a plural word a common thing in practice?
I thought best-practice was to name relations either singular (as each tuple represents one entry) or uninflected (still singular for most words), specially when you're not a fluent speaker of the language being used to name the relations of the database.
Plurals are often irregular for commonly used words, and the fact that this requires a external dependency ( https://github.com/plurals/pluralize https://github.com/plurals/pluralize ) to cover for some "common plurals" is telling that supporting this feature is a complex thing indeed - that would not be required in the first place with singular everywhere.
- e12e 3y ago>> The primary key column is named id or thing_id or thingId, where thing is the singular form of the table name. > Is it naming relations a plural word a common thing in practice? It's unfortunately what rails ActiveRecord does, and other solutions inspired by Rails. If one keep the domain models and tables in a consistent language (ie translate everything to English) - it is somewhat consistent, and the code reads somewhat pleasantly like a DSL. In practice I find that business logic/data modelling needs to/should be done in local language and then this becomes a bit of an annoyance and point of friction. https://guides.rubyonrails.org/active_record_basics.html#naming-conventions https://guides.rubyonrails.org/active_record_basics.html#nam...