mercredi 25 février 2015

Suitable schema to record email sent and response received and invoicing in DB


When a form submission is made on a website:




  1. An email with form's details is sent to a set of recipients email addresses stored in a DB.




  2. The email contains a link for the recipient to show interest. When the link is clicked a response is sent to server with verify_code. The server will UPDATE the table below setting has_confirmed to true or 1 to record their interest on DB.




  3. An email is sent back to the recipient as acknowledgement




This is the current table to record the above:




RequestSentConfirmation





Sent_ID (int) PK
Request_Id (int) FK
Recipient_Id (int) FK
verfied_code (varchar(100))
has_confirmed (bool)
when_confirmed (datetime)


Request_Id is ID to form submission details stored in another table. Recipient_Id is ID to recipient email addresses stored in another table.


Is it better to store the has_confirmed in the same table as above.


The confirmations are required to collect and generate an invoice for each recipient. To generate an invoice from above table I will need to run SQL script to check which sent emails are confirmed.


Or best to store the confirmations in separate table? That way I could run reporting script on the separate confirmation table to generate invoice for each recipient?


Is there a better way to design this with DB since I'm using emailing here.





Aucun commentaire:

Enregistrer un commentaire