mercredi 23 avril 2014

Users database table scenario. Good or bad?


Vote count:

0




I've got a table users which also has a column active that is either 0 or 1. And a activation_keys table that stores the activation keys for newly registered inactive user (where active == 0).


All the users that register for a new account will start off inactive and will always have a matching relational row in the activation_keys table. If a user activates his/her account, the relational row is removed from the activation_keys table and active is set to 1 for that user in the users table.


But now I want to also be able to disable users by setting active to 0. And to distinguish a newly registered user that still needs to activate his account and a user that's disabled, I'll be checking if there is a relational activation key in the activation_keys table. If there is, that means the user is not disabled. If there isn't, it means that the user is disabled and should not have access to his account.


Is the way I just described a good way to handle it?


Also, I would end up with a mixture of disabled and active users in the users table. Is that fine, or should I remove the disabled users to another table specifically for that?


Any suggestions are welcome.



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire