Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I want to begin implementing user functionality on my website, but I'm not sure exactly what kind of information I should be storing. Obviously the basic things like username, password, password hash, real name, email, etc..., but what are some other things that might be useful to know about the user, in a general sense? (I've been tossing around things like last login, login location)

share|improve this question
    
Don't store password. Store the hash only. –  sqlvogel Jun 29 '11 at 11:34
    
Also this is similar to the question [dba.stackexchange.com/questions/3768/… [1]: dba.stackexchange.com/questions/3768/… –  Leah Jul 22 '11 at 8:51
    
Django project's auth system has a reasonable default. By definition this was built for the "general" sense. –  User Oct 27 '12 at 21:16
add comment

2 Answers

up vote 3 down vote accepted

This is what I recommend for absolute, must-have fields in a users table:

Is there a standard implementation of a Users Database?

Things like last login, login location, login IP, etc. are better served in a historical table where you can run inserts and then query against the table if you need information. The idea is to have infrequent updates in a heavily used table, like users. Purge old records as necessary.

share|improve this answer
add comment

In my opinion (and experience) you can lay out a nice laundry list of data that should be persisted in the database, but no matter how much thinking you do and talking to professionals, half way through the project you're going to find another half dozen pieces of data that you want to keep. Get to a good point and start it up. Then make appropriate changes when necessary.

Good luck! Authentication/authorization is very very fun stuff when it comes to databases.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.