PDA

View Full Version : Multi Company within same database


ABC123

askoog66
12-31-2010, 01:33 PM
We are a landscape company that has developed our own custom database since the DataStar using CP/M days up to Microsoft Access 2003. We started asking ourselves why we couldn't "commercialize" what we have done so other small landscape companies wouldn't have to reinvent the wheel and use our system. After many days of research we have settled on what appears to be a great solution with Alpha Five.

Therefore, we have all of the typical newbie questions of going from Access to MySQL/AlphaFive along with the bigger overall design of the database. I am currently paralyzed as to the direction I should go in by converting our current single company designed database into a multi-company database.

If there is one thing we have learned over the last 25 years that the database will be evolutionary and not revolutionary. Meaning, there will be constant changes/improvements to the code/design of the database. Thus, I would like to stay with a single database design so that I do not have to track and maintain individual databases for each company.

Therefore, basically all of my tables in the database will have to have columns and keys added with a company id in order to filter out data from other companies. The problem is how to manage the users and companies logging into the database. Examples being Company A may only need 2 simultaneous users while Company B needs 7 simultaneous users and then isolating them to manipulate only there data from all of the communal tables. I envision our commercial model will be company's paying a monthly fee based on how many simultaneous users they need.

I have looked at the web security framework and AlphaToGo's frameworks and understand them to be basically designed for single company designs. I need that type of framework, but another layer added above that for a company level.

Hope this makes sense. Unforunately, I have never had a formal database or for that matter computer class and have learned everything I know from reading, time, and a lot of mistakes. I have also learned that the first steps are the most crucial as to laying the foundation for the rest of the database.

Thoughts, directions, and theories would be greatly appreciated.

Peter.Greulich
01-03-2011, 10:25 PM
I think you are on the right track. If it were me, I would start by building a user management grid tied back to security. Your user grid would include company name/id as well as user id. When the user logs in, you retrieve the company id as well as the user id and set them to session variables. All tables will need a company_id field as you suggest and you then filter the tables on the company session variable.

askoog66
01-06-2011, 01:27 AM
Thanks for the input. Since I have never come up with an original idea in my life, do you know of any examples I could look at of a user management grid being tied back to security that you spoke of?

Peter.Greulich
01-07-2011, 03:01 PM
If you send me an email, maybe I could send you a sample component to study.

Also look at:

http://msgboard.alphasoftware.com/alphaforum/showthread.php?p=560609#post560609