Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should 1-time use data like verification code to be stored in the same table

When a user registers an account, I issue a verification code that is later used to verify the account. Once verified, the account is marked verified=1 and the verification code erased. Should such data like the verification code be placed in a separate table?

like image 630
zmol Avatar asked Feb 14 '11 13:02

zmol


2 Answers

This is of course much better to store temporary data separate from nontemporary. There is no need to store that key in the account table. Have some tblVerificationCodes with FKs to the account table, timestamps etc etc and delete (or archieve if needed) data from this table when its possible. This is very good style.

like image 120
Alexander Sobolev Avatar answered Nov 03 '22 22:11

Alexander Sobolev


if you plan to store some other data, like verificationDate, ipAddress, etc. you should use a different table for verification information. But if you do not plan to use any data, but the "verified" column, about the verification, only one column can be stored in the same table,

like image 38
fsonmezay Avatar answered Nov 03 '22 22:11

fsonmezay