1 Preface
In the recent project development process, I encountered Database Design Problems and referred to multiple databases, summary of some of the relevant database entities and relationships. During the month, I also wrote a MySQL database design review notes and project practices. Now I will summarize them again, the database design and specific persistence and cache implementation in the project are added.
Database as the underlying layer, naming conventions and changes will directly affect the upper layer, so we need to be cautious in design.
This article describes three aspects: Database entity and relationship processing, data persistence, and cache processing.
First, I am a buyer. The open-source project design software uses MySQL Workbench.
Click to View Details
2 entity and associated processing
Filter entities. We can see that the figure is mainly divided into six parts.
Entity table Goods Products Communicate Group Say I said Comment Url site Brand Compaign Activity |
User table |
Relational table Userandmodel user model relationship Modelandmodel model relationship aactionandmodel Page Object relationship Tags TAG object relation |
Resource table Image Album |
Group Table Group Topic Post reply Userandgroup User Group Association |
Common Site tables Systemtree system tree Content Ad Report District Region Log Services Customer Service staff Mail insite email |
User-centered. The user table is placed in the middle and associated with other entities.
Entity tableYou can add related application entities for extension.
Relational tableIt consists of four tables.
User and model Association tables, such as: James likes IPOD and Lisi wants to buy IPOD linktype = "like/buy"
Model Association table, such as product comment, associated modela product modelb comment
Actionandmodel page model Association Table tag keywords and object Association Table
Resource Tables mainly contain image ablum image tables that contain images associated with system object classes
The group table contains the group, topic, and post userandgroup. The group is independent of the system independent module.
Frequently used tables are often separated from entity tables and placed in the tables required by the site.