While working on Nulis and while attempting to solve some other problems I began to need to document the contents of wordpress databases. The first problem I sought to solve was to build a visual map of the site. This needs the schema to be understood and the table contents to be extracted. This needs the login parameters and a connection route. The second problem involves creating a new template and will need it’s SQL designed and encapsulated in PHP.
This article documents the relationships between tags and posts, which can be categories and pages.
In order to extract the schema logic, I was pointed at this page at Stack Over flow.
From these I examined,
the first requires java which is not always available in hosting environments, the second doesn’t seem to do foreign keys, at least not with My SQL, it does however work from the SQL/DDL. It might be best to extract the schema using mysqldump, parse it using a scripting language and generate the graph using dot. (This of course could be used to generate an html page).
While looking for an image to decorate this page, using google image search with the keywords “wordpress database” I came across a bunch of schema diagrams, I wonder if these are useful and usable. It would seem they are, here is Database Descriptions at the WordPress Codex. It’s documented as V3.3, so I will check if it’s changed since.
Here is the schema diagram.
The featured image taken from http://www.metserve.com/blog/optimise-wordpress-database