This topic is locked
[SOLVED]

Multi Tenancy

4/11/2021 9:32:31 AM
PHPRunner General questions
L
Lance Spurgeon author

I am developing a solution where I want to end up with 1 application with multiple mysql databases one per company (Multi Tenancy refering Saas DB). There are certain tables that should remain in the landlord table and others with the tenancy database.

  • my question when it comes to users should remain in the landlord dabase. I realise when the user logs in they can be redirect to their own database via session which works great, however when a user wants to update their profile which database would they be updating the landlord or the tenant table?
  • can this be done with the Enterprices with multiple connections or how does this work?

I hope my question makes sense?

admin 4/12/2021

This question makes total sense. The idea is somehow to tell what tenant the current user belongs to. One approach is to do that based on the username. Check this article that explains all the details: SaaS application design . All users will be stored in the same common database and when they edit their user profile it will be edited in the common database.

The secomd approach is to create a subdomain for each tenant like tenant1.website.com, tenant2.website.com etc. In this case you can use subdomain name to figure out the database name and each tenant's database can have their own users table.

L
Lance Spurgeon author 4/14/2021

Sorry to reopen this. If I wanted both solutions would I need Enterprise for this or can this be done with the standard PHPRunner?

admin 4/14/2021

Both solutions will require Enterprise Edtion. In either case you need a common database where clients sign up, where you store all their data and billing info and all kind of common data. Then you would need a separate database for each clients data.

L
Lance Spurgeon author 4/14/2021

thank you so much, i will have to get the upgrade