My users will be businesses with a small number of accounts each: e.g. Business #1 with 3 users, Business #2 with 5 users, etc.
I am trying to determine the best way to organise the relation (on Postgresql, hosted on AWS) for each business client: for e.g. each business will have their own sets of customers
, logs
, products
, config
relations.
I want to create a scaleable database across all client businesses.
- Do I create a single relation, e.g. of
customers
, for all my clients? E.g. each business client is given a unique ID, and during onboarding of the business user, the user's account is tied to the specific business UID. Examples in 2 images below.
This seems like a huge security risk given that all business information is stored in a single table/DB.
- OR, do I create individual databases hosted separately in AWS for each business? This seems safe, but also practically not scaleable and expensive!
I'm pretty sure there's a middle path where all B2B apps tread which my inexperience simply makes me oblivious to.
I've read this and this. My question is more directed to the implementation of the table if I were to go with a shared DB and shared schema.