Database Design, Referencing the WordPress Database

Please repost with source and author noted, thank you, www.neilren.com. Recently I have a big ASP.NET assignment, the “News Publishing Management System” — this should be my debut. The first step is to design the database, which reminded me of WordPress. News is just one article after another; for article management and publishing, WordPress is excellent, and WordPress also supports installing plugins to make it endlessly variable. Let’s look at what WordPress’s database design looks like, which allows it to be so variable. The WordPress database structure and explanation are on the official site; I’ll just paste my castrated version, because it’s only for a homework assignment and there’s only a month, and the requirements don’t ask for a comment feature, so I cut the comment table — don’t want it. First let’s look at my table relationships. QQ20131120101132 Let me explain: nr_user: user table, stores users’ basic information nr_usermeta: user description table, describes users’ status, permissions, etc. nr_posts: posts table, the core table, all posts are here nr_term_relationships: category-post link table, indicates the relationship between posts and categories nr_terms: category table, the categories of posts nr_postmeta: post description table, describes the related attributes of posts, when modified, whether pinned to top, etc. nr_options: system global table, stores the site name, global settings, etc. Although there are only 7 tables, very simple, it almost meets all my needs. For example, one day if I’m bored and want to add user points or user levels, I only need to add a record in the nr_usermeta: user description table, recording a key and value under meta_key and meta_value, and I can describe a user’s points or level without modifying the database again. This also allows plugin usage — letting plugins use the database to add their own keys, making the plugin’s features more powerful. So I really like this design; it allows the business logic layer on top to be endlessly variable.