Create database tables and manage activity over time
P粉0546168672023-09-14 09:27:53
0
1
556
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
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.
You have several options for events.
Regardless, the logic behind activity management is handled by the application.