-1

There are two types of users One is Free and the other is Paid user. As a user with the role FreeUser, I can have only 3 open (Time not over yet) activities, as PayingUser unlimited. How to manage this in a database table

AR Soft
  • 51
  • 2
  • 6
  • Does this answer your question? [How can you represent inheritance in a database?](https://stackoverflow.com/questions/3579079/how-can-you-represent-inheritance-in-a-database) – philipxy Feb 24 '23 at 11:56

1 Answers1

0
UserType
  usertypeid, PK
  usertype, NN

User
  userid, PK
  username, NN
  usertype, FK UserType.usertypeid

For the activities, you have a couple options.

  • store the activities counter in the user session.
  • store the activities counter in the database. That can be a simple counter in the users table
  • in the event you have a high availability configuration (more than 1 application server), you will have to share sessions, or store the counter in the database to ensure your counter survives a server going down.

Regardless, the logic behind the management of activities is handled by the application.

Nic3500
  • 8,144
  • 10
  • 29
  • 40