I am currently refactoring a system.
I've got the following situation:
The system is about providing information about companies across several business sectors. Each company can be active in one or more sectors. Companies can be participating in certain partner programmes. An a company can have one or more partner manufacturers (e.g. a garage can have a partnership with BMW/Mercedes) etc. All of these participations exist a given period of time (validity period). Additionally, a manufacturer like BMW is bound to one business sector. So a company can only be partner of BMW, if BMW is valid for the companies business sector. That is, because the system does not just maintain companies of a business sector like a garages, but also towing services etc.
So right now my design can cause some invariants.
Company -> Assignment (not slowly changing) -> Business Sector
Company -> Partnership (date from - to) -> Organisation <- Business Sector
Where Company and Organisation must share the same Business Sector assignment.
So right now, one could change the business sector assigment of an Organisation. Then this would the rule of having the same business sector to be invalid.
How would you model something like that?