Register Database Design
1. Previous
Id
Username
Password
......
Username plus password, address simple requirements, leave an ID as a foreign key to other tables. Of course, then the password may also be plaintext storage, better know MD5.
2. Later
ID//PRIMARY key
Username//Account
Password//password
Name//Nickname
Phone//Telephone
Email//Email
Realname//real name
Sex//gender
Ages//Age
Qq
Address//Addresses
HEAD_IMG//Avatar Address
Rights//Permissions
Status//Account state
Register_time//Registration time
REGISTER_IP//Registered Address
Login_time//Login time
LOGIN_IP//Login Address
......
With the expansion of business needs, to add a user state status to determine whether the user is banned, registration time and registered IP address, last login time and IP address for reference (and derived from the login record table, used to determine whether remote login, etc.), user Role/Permissions rights (also derived from the user role permission relationship, or another discussion), the business also requires personal information such as real name, address and so on a brain to add, and now form a very complete user relationship table.
3. Web2.0 era
In the Web2.0 era, Weibo has opened third-party websites.
Later it was a variety of third-party website Login.
User base Information table users
Id
Nickname
Avatar
......
User authorization Information Sheet user_auths
Id
user_id
Identity_type Login type (mobile phone number, email username) or third party app name (Weibo, etc.)
Identifier identification (mobile phone number mailbox user name or third party app's unique identity)
Credential Password voucher (store password within the station, do not save or save tokens outside the station)
......
Design of a third-party login Registration database table