I am struggling with modelling my database so that entities can only have a many-to-many relationship if they share the same "parent" entity.
Here's an example:
- Folders have a one-to-many relationship with Presentations.
- Folders have a one-to-many relationship with Photos.
- Presentations and Photos have a many-to-many relationship.
Is there a way of enforcing that Presentations and Photos are only related if they belong to the same Folder - that they share the same foreign key?