Note that there are some explanatory texts on larger screens.

plurals
  1. PODatabase Schema - User Subscriptions
    primarykey
    data
    text
    <p>I have a subscription model in my database that subscribes users to the courses for certain months. There are few types of assignment. User can:</p> <ol> <li>Purchase course x month subscription with Credit Card</li> <li>Purchase course x month subscription by entering some Activation Key </li> <li>System administrator assign user to x month subscription.</li> </ol> <p>If user renew his/her subscription I’m not deleting the old one, I’m creating a new record in the subscriptions table and keep old one as a history, also if the same subscription is updated by administrator I’m creating new record again. User’s current subscription is identified by the last record. The expiration date for the user to course is the date that is displayed in the latest record. For example if you check the attached screenshot.</p> <p><img src="https://i.stack.imgur.com/hoipt.png" alt="enter image description here"></p> <p>User 1 has three subscriptions and one of them says that course must be expired in June 15, however the real expiration date is June 14, because this is the latest record for this user - course combination.</p> <p>The reason why I keep all these records (and not just updating the existing user-course expiration date) is that I need this history. If something go wrong, I’ll always be able to recover where a mistake was.</p> <p>I think you’ve got my idea, my question is, if this is a good solution and how can better implementation idea look like.</p> <p>Thanks for your time.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload