Developing a multitenant application meaning one database, multiple companies. I have a problem understanding the correct data model and was hoping someone could provide me with the best insight to handle this problem.
Say I have a CompanyEntity and each CompanyEntity can create multiple pageEntities. (1 x n) No Problem. However, each pageEntity can have one and only one PageTypeEntity (m x 1 relation currently between PageEntity and PageTypeEntity). The problem is that the PageTypeEntity is basically a standard lookup table with a colum called pageTypeName (i.e. I have defined 5 PageTypeEntities in a lookup table ex. Company, Business Unit, Patch, etc...), how does one allow each company entity to modify the name of the PageTypeEnities for their own specific purposes?
In essence, each company can have a page and the page can only have one pagetype but the pagetypename can be different foreach company
CompanyEntity PageTypes w PageTypeName modified
company1 Company, Business Unit, Release, Patch
company2 Company, Organization, Maintanence, update
I have gotten this to work fine for 1 company, however since this is a multitenant application, not sure of the best approach. I was thinking maybe I should make make PageEntity and PageTypeEntity an m x n relation and a colum for pageTypeName to the m x n relation table. Suggestions?
Optionally, everytime I create a new company in the db I could just add a new set of pagestypes to the pagetypes table related to that specific company. However that seems somewhat inefficient as I will need to create the same pagestypes for each company.