MySQL user-oriented core database for building an SNS website (1)

Source: Internet
Author: User

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.


Related Article

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.