WordPress Database Structure Updates Since Version 2.2

Posted on June 3, 2008
Filed Under WordPress Database |

WordPress 2.2 supports all basic blogging features, — posts, pages, links, categories, and comments. However, It was behind the trend by missing one important thing, — the tag function.

Then WordPress 2.3 came to catch up. Comparing to version 2.2, the 2.3 upgrade has some significant database structure changes. Two tables were removed, and three tables were added. The following chart shows the difference of WordPress database tables between version 2.2 and 2.3, and 2.5 as well.

WP 2.2 WP 2.3 WP 2.5
wp_categories
wp_comments
wp_link2cat
wp_links
wp_options
wp_post2cat
wp_postmeta
wp_posts



wp_usermeta
wp_users

wp_comments

wp_links
wp_options

wp_postmeta
wp_posts
wp_term_relationships
wp_term_taxonomy wp_terms
wp_usermeta
wp_users

wp_comments

wp_links
wp_options

wp_postmeta
wp_posts
wp_term_relationships
wp_term_taxonomy
wp_terms
wp_usermeta
wp_users

In WP 2.3, the dedicated category table “wp_categories” and the link/category relationship table were no longer used. Instead, the category is handled by new table “wp_terms”. This new table stores categories for both posts and links, and it also holds tags. All the relationships are resolved by the 2 new tables, — “wp_term_relationships” and “wp_term_taxonomy”.

The new “term” and “taxonomy” structure provides WordPress much better flexibility to handling categories and tags.  That’s great!

As you can see from the above chart, the database changes from version 2.3 to 2.5 are minor. Version 2.5 uses the same tables as that in 2.3. However, there are some column attributes adjustments in a few tables. These changes are outlined by the following article:

2.3 to 2.5 Database Changes

Here’s the summary of database changes from 2.3 to 2.5:

Table: comments

Changed ‘comment_approved’ to varchar(20) NOT NULL default ‘1′
Added KEY ‘comment_approved_date_gmt’ (comment_approved, comment_date_gmt)
Added KEY ‘comment_date_gmt’ (comment_date_gmt)

Table: links

Changed ‘link_visible’ to varchar(20) NOT NULL default ‘Y’

Table: options

Changed ‘autoload’ to varchar(20) NOT NULL default ‘yes’

Table: posts

Changed ‘post_status’ to varchar(20) NOT NULL default ‘publish’
Changed ‘comment_status’ to varchar(20) NOT NULL default ‘open’
Changed ‘ping_status’ to varchar(20) NOT NULL default ‘open’

Table: term_relationships

Added ‘term_order’ int(11) NOT NULL default 0

Comments

Leave a Reply




*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word