Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's not bad. However, I would suggest that you add two fields to <code>tbl_user</code>:</p> <pre><code>tbl_user ---------------- id name status_id activated_date expiry_date </code></pre> <p>Of course, <code>activated_date</code> holds the date they were first activated, while <code>expiry_date</code> holds the date when they will expire. You also need a procedure to update this <code>expiry_date</code>, whenever they buy a new card. This procedure should handle two cards with overlapping dates, so the user doesn't double-up payment for a particular period. For example:</p> <ul> <li><strong>Card 1</strong> - Sep 1 to Sep 30</li> <li><strong>Card 2</strong> - Sep 16 to Oct 15</li> </ul> <p>There are fifteen days of overlap there, so the user's <code>activated_date</code> should be <em>Sep 1</em>, while their <code>expiry_date</code> should be <em>Oct 30</em> (Oct 15 + 15 days).</p> <p>Considering this, I would change <code>tbl_activation_code</code>, as <code>expiry_date</code> becomes a bit misleading. Instead, create a column called <code>access_days</code> that will be used to calculate the user's <code>expiry_date</code>.</p> <p>Also, if you want to remember cards that were issued, even if not activated, then I would split <code>tbl_activation_code</code> into two tables:</p> <pre><code>tbl_activation_code ---------------- activation_code activation_code_type_id activation_code_status_id access_days tbl_activation ---------------- activation_code_id user_id activated_date </code></pre>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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