I’m working on a project management app, where every company (which uses our app) will have a personal subdomain: company.domain.com. For many reasons I decided to use a separate database for each company.
Companies can invite people (by email) to work together on projects. A user can belong to multiple companies (so should appear in multiple databases). However, user data, and login information are stored in a seperate db because users use the same username, password for each company, and their first name, and last name is the same for each company.
What I do now, is the following:
- there exists a separate database with: users, identities (user_id, username, password).
- there also exists a users table in every database of each company, containing the same data about the user (actually only 3 fields: first name, last name, time zone).
Is there a better solution for this?
If you have questions about the question 🙂 please ask.
I’m using php + mysql.
I don’t think having the user data amongst more data tables is correct – think about redundancy…
If You have a database containing user data, why not having company databases linked to this database for user data?
A simple image:

Within Your companies databases You then can have additional company based user data within users table but the common data should remain only once per storage…
EDIT: ORA storage is just for example, You can use a MySQL database as well…