Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Those who do not learn from relational databases are doomed to migrate to them.

Have an owners table, a pets table, and an owns table. Right from the start. It's the shape of the data, model it correctly from the beginning. Two people can own one cat. One person can own two cats. Model this relationship in the store.

Are there rare cases where a one-to-n rather than m-to-n relationship obtains? Maybe, but then again, you should assume you're wrong about that and interrogate the subject very carefully before deciding that one-to-one or one-to-n is correct.

The thing is that those cases can be modeled as m-to-n where one or both happen to be 1. Unless some error would arise from not preserving the singleton invariant, don't bake it in.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: