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)
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
This is what I recommend for absolute, must-have fields in a users table:
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.
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.