Should you ever have to-one relationships between entities? [closed]
To-one relationships occasionally evolve into to-many relationships. Once that happens, your team has a tricky job of refactoring the datastore, the backend to allow that change. For example, some time ago, our app used to have many-to-one relationships between doctors and wards. But doctors are not always paid handsomely, some double in other wards. So now we have a many-to-many relationship between doctors and wards. An additional problem is DOCTOR still, to this day, has columns linking it to wards and positions (for example, a surgeon in a surgery ward). The resulting inconsistency has led to some bugs. So should you have to-many relationships between entities at all? Maybe, you should always, 100% of the time, model entity relationships as to-many, shouldn't you? To-one may be seen simply as a special case of to-many. The assumption "Oh, there's no way this would ever become to-many" has failed so many times, it's dangerous and has no significant benefits (performance my **s). Am I wrong?
To-one relationships occasionally evolve into to-many relationships. Once that happens, your team has a tricky job of refactoring the datastore, the backend to allow that change.
For example, some time ago, our app used to have many-to-one relationships between doctors and wards. But doctors are not always paid handsomely, some double in other wards. So now we have a many-to-many relationship between doctors and wards. An additional problem is DOCTOR
still, to this day, has columns linking it to wards and positions (for example, a surgeon in a surgery ward). The resulting inconsistency has led to some bugs.
So should you have to-many relationships between entities at all?
Maybe, you should always, 100% of the time, model entity relationships as to-many, shouldn't you? To-one may be seen simply as a special case of to-many. The assumption "Oh, there's no way this would ever become to-many" has failed so many times, it's dangerous and has no significant benefits (performance my **s). Am I wrong?