3 ms·
> I don't think so. We're naming the collection. The relation is the foreign key. that's why you would see `user_id`, not `users_id`. that depends on your inte
by spinningslate 3y ago
> I don't think so. We're naming the collection. The relation is the foreign key. that's why you would see `user_id`, not `users_id`.
that depends on your interpretation of "strictly speaking". As a (loose) implementation of the Relational Model[1], a table is indeed a Relation. In practical terms however - particularly with an ORM in play - a table stores a collection of entities, with relationships (not relations) implemented as foreign keys as you say.
> that's why you would see `user_id`, not `users_id`
Hmm, not really. Even in the relational interpretation, each row represents a single tuple in the relation. So singular phrasing for the attribute names is appropriate.
[1] https://en.wikipedia.org/wiki/Relational_model https://en.wikipedia.org/wiki/Relational_model