Drupal 6 comes with a DB schema, which makes it possible now to programmatically draw a graph of the relationships among the tables.

Utilizing graphviz I played with the possibilities yesterday and here's a thumbnail of the result. Full-size versions can be found here.

The '.svg' and '.html' versions display a descriptive tooltip when you hover the mouse over fields.

Many tables are linked by "node.nid" or "user.uid" and in order to not clutter the display with too many "snakes" I colored "node.nid" links in green and "user.uid" ones in red. So wherever you see red or green lines don't bother following them with your eyes: you already know where they lead to.

Note that everything is done automatically. No tweaking is done by hand. The script uses drupal_get_schema() to learn about Drupal and a 'Makefile' is used to automate the generation of the various output files.

Comments

gpk’s picture

Fantastic! Been waiting for this for years. (Well, months at least!)

Many thanks for making this.

gpk
----
www.alexoria.co.uk

mooffie’s picture

Thanks.

I should mention here the efforts made by webchick, add1sun, bjaspan, and others, to make all this possible (and easy (and fun! :-)).

gpk’s picture

OK, thanks to the whole team then ;-)

In fact this is so good that it really ought to be featured as a News item - finally everyone can understand the Drupal DB structure. A page in the handbook would simply not be enough to mark this giant leap for Drupaldom! Also found the Schema module. Arguably should be in core since it could be a vital admin tool (particularly at upgrade time ...!) Looks fantastic :-D

gpk
----
www.alexoria.co.uk