Drupal 6's self-documenting database schema

After many previous attempts and false starts, Drupal 6's entire core database schema is now documented and cross referenced. You can view the documentation using the contributed Schema module; see the attached screenshot for a demonstration (click to enlarge). Thanks to webchick, add1sun, pwolanin, JirkaRybka, Moshe, chx, yched, and others for contributing their knowledge of the dusty corners of the schema.

If you are a module author, when you port a module to Drupal 6 and create your hook_schema() function, you should also document the schema. Doing so is easy: just add 'description' fields to each table and field in the schema structure. For example:

<?php
function mymodule_schema() {
 
$schema['mytable'] = array(
   
'description' => t('Stores whiz-bang cool data for nodes provided by the MyModule module.'),
   
'fields' => array(
     
'nid' => array(
       
'type' => 'int',
       
'not null' => TRUE,
       
'description' => t('The {node}.nid that this row is for.'),
      ),
 
// etc.
 
return $schema;
}
?>

Placing a table reference within a description inside of curly-braces causes the reference to be displayed as a hyperlink to that table's documentation on the Schema Describe page.