1 tabledrag_example.install tabledrag_example_schema()

Implements hook_schema().

This defines the database table which will hold the example item info.

Related topics

File

modules/examples/tabledrag_example/tabledrag_example.install, line 17
Install and uninstall functions for the tabledrag example module.

Code

function tabledrag_example_schema() {
  $schema['tabledrag_example'] = array(
    'description' => 'Stores some entries for our tabledrag fun.',
    'fields' => array(
      'id' => array(
        'description' => 'The primary identifier for each item',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'A name for this item',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'description' => 'A description for this item',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'itemgroup' => array(
        'description' => 'The group this item belongs to',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'weight' => array(
        'description' => 'The sortable weight for this item',
        'type' => 'int',
        'length' => 11,
        'not null' => TRUE,
        'default' => 0,
      ),
      'pid' => array(
        'description' => 'The primary id of the parent for this item',
        'type' => 'int',
        'length' => 11,
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'depth' => array(
        'description' => 'The depth of this item within the tree',
        'type' => 'int',
        'size' => 'small',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array('id'),
  );
  return $schema;
}