4 ms·
In the example, the code for user is broken, because user is a reserved keyword. This is the whole reason we pluralize. That, and we are naming a collection of
by gabereiser 3y ago
In the example, the code for user is broken, because user is a reserved keyword. This is the whole reason we pluralize. That, and we are naming a collection of relations and not naming a relation (that’s FK). The schema of the row is the object. The table is just a collection of rows with the same schema.
The fact that the article recommends user over users shows they have no authority naming anything at the database level.
- edgyquant 3y agoPretty trivial to get around this with Postgres, just put quotes around the table name. That’s what I’ve always done anyway
- gabereiser 3y agoYes but it’s non-standard. Some engines use quotes, some back ticks. If someone uses an orm then it’s gets tricky if the orm doesn’t automatically escape and you can manually specify table name. If you are hand writing a DAL then by all means name it whatever you want. To me having a table as singular goes against what a table is.
- elchief 3y agoOr use plural table names hehe