Designing user subscription along with existing organisation subscription

We have an existing implementation where all users belong to an organisation will depend on the organisation subscription, so if the subscription has ended all users belong to this organisation will not be able to access our web application. They won’t be able to login due to expired subscription.

Sample DB Schema for Existing Implementation:

Now we want to implement a subscription not only for an organisation but also for individual user. So there will be:

Trial (for 1 user and with limited access to some features) Subscription 1 (for 1 user) Subscription 2 (for 20 user) Subscription 3 (this is an enterprise and would depend on how many allowed users an enterprise want). By this I have to track user who are in trial subscription with their start and end date however there is also a problem this trial user has an organisation which in the existing implementation organisation has allowed accounts and renewal date (expiration date of their subscription).

I’m thinking to create a subscription table where I will add user_id and organisation_id in this table and will include the start and end date also the type of subscription whether trial, subscription 1, subscription 2 or subscription 3. But I’m worried this would be a bad implementation knowing organisation table has already allowed accounts (how many user could access our web application) and renewal date (which is their expiration date of their subscription). Any suggestion on this? I would really appreciate it.

1 Like

Could you please clarify one thing: if a user is already part of an organization which has an unexpired subscription, will he be allowed to also sign up for an individual trial subscription or will he be restricted to just the one?

he can as long as s/he will not use the same account and did not associate her/himself to the institution. In our web application registration you can’t register without choosing an organisation so it is required but it does not limit the user to choose an organisation.

So the flow is, we have existing clients who registered their institution to our web application that was the time the registration functionality has not been implemented yet so the development is still on going for this. And this existing institutions were given number of accounts that they can add to their subscription. Now we wanted it to have a registration for scaling, so we allow individual user to sign up. This individual user has their own organisation and this organisation/institution is not yet set up to our web application so we review them then add after then we give user 30-day free trial to access the app. By doing this, it will cause a problem to the older implementation since the app is not build into this. So I start asking people if what would be the best approach on dealing with this.

use two separate tables

look up the user first in the user subscription table… if exists, allow access, if not, look up the user in the organization subscription table

if you use a single table with both user_id and organization_id, you will need complex query logic which might also lack efficiency

so it would look like this?

i wouldn’t name the two subscription tables the same, but yeah :wink:

what’s the difference between the two “allowed accounts” integers?

nothing I will remove that :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.