table with multiple possible one-to-many relation, but not many-to-many
I have an image table which looks like this, it has many possible one-to-many relationships, ie. room, profile and feedback can have many images.
The issue is, I want the image to have only one relation at a time. So I don't want it to be possible for image to have both roomId and feedbackId as not null.
Want to know if this is possible. Also is there a better way to do images? How would you do tables for a relation like this?
0 Replies