Home  >  Q&A  >  body text

Create database tables and manage activity over time

There are two types of users, one is free users and the other is paid users. As a user with the FreeUser role, I can only have 3 open (time has not yet ended) activities because PayingUser has no limit. How to manage it in database table

P粉054616867P粉054616867401 days ago523

reply all(1)I'll reply

  • P粉155710425

    P粉1557104252023-09-15 00:29:21

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

    You have several options for events.

    • Store the activity counter in the user session.
    • Store the activity counter in the database. This can be a simple counter in the users table
    • If you have a high availability configuration (more than 1 application server) you will have to share sessions, or store counters in a database to ensure that your counters still function in the event of a server failure.

    Regardless, the logic behind activity management is handled by the application.

    reply
    0
  • Cancelreply