"Nothing"---2---database design -1_ Distributed System notes

Source: Internet
Author: User
Tags modifier

Any system needs people's participation at present, the electrical business system needs customers, enterprise system needs employees, unattended systems also need operators.

So in the business object, people are a necessary design object, whether or not the core business object

Person table

Field name type role ID integer person data Id name character user name Sex integer sex birthday date Birth date Idcard character ID number status integer data state createtime long high precision date data creation time creat Eby integer Creator: human data ID modifytime long high precision date data modification time modifyby integer modifier: human data ID isdelete* boolean data tombstone

The data user ID selects an integral type instead of a GUID type for index optimization. The last logical deletion field is used, can be changed according to business rules, usually do not recommend the direct physical deletion of human data, which may cause the business data could not find the associated person, but the tombstone has a problem is that if it is a faster-changing system, it may produce a lot of redundant data, Based on performance, operational dimensions, and business maintenance considerations, it is best to use the first logical deletion and then physical transfer of discarded data.

Also, from data security and business security considerations, creation time and modification time fields, creator and modifier fields are necessary, and each table is required. However, the higher security requirements of the data requires a special Operation record maintenance table, and the data of the person with ID rather than character name, is due to the consideration of data variability.

This is the basis of a person's natural property sheet, the System user business object can be based on this table, but not suitable for the full integration with this table.

User table
field data type action UserName character user name picture character avatar address PersonId integer person table data ID ID integer data ID status Integer data state createtime long high precision date data creation time Cre Ateby Integer Creator: human data ID modifytime long high precision date data modification time modifyby integer modifier: human data ID isdelete boolean data tombstone

UserName, usually this table also acts as a login information base table, this field is also the login name, but there will be some problems, especially when the login mode is diverse, such as mobile phone number, mailbox can also log in, so this table as a simple user object storage

User objects usually do not have uniqueness, a person will have multiple user names, so PersonID fields cannot be a uniqueness constraint

Loginuser table
field data type action LoginName character login Password character login password UserId integer user table data id ID integer data ID status Integer data state createtime long high precision date data creation time creat Eby integer Creator: human data ID modifytime long high precision date data modification time modifyby integer modifier: human data ID isdelete boolean data tombstone

The data in the user table and the data in the Loginuser table are a one-to-many relationship, especially if the current login mode is diverse. So the previous popular user table and Loginuser table Fusion design is not very suitable.

Because the loginname does not have data invariance, may change for various reasons, so the data change needs to determine a principle, the new data login can not violate the original data, otherwise, the users of the data violated will find their own login or login mode lost.

Contacts table


field data type action Email character person's mailbox mobile character mobile phone number address character contact QQ character QQ number CityName character City ZipCode character zip PersonId integer person table data i d UserId Integer user table data id ID integer data ID status Integer data state createtime long high precision date data creation time CreateBy integral creator: Human data Id modifytime long high precision date data modification time M odifyby integer modifier: human data ID isdelete boolean data tombstone

In query performance considerations, the user table and the ID of the person table are stored here





This series of technical accumulation (no super cattle) of the organization as the target, the data volume is not intended to the direction of Ali and penguins to think, design goals enough on the line, did not become the GCC circulation software that delusion. So, if it's not the kind of bug that causes economic loss or is technically too humiliating, I hope everyone will throw bricks at it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.