You are here

function nodeapi_example_schema in Examples for Developers 6

Same name and namespace in other branches
  1. 7 nodeapi_example/nodeapi_example.install \nodeapi_example_schema()

Implementation of hook_schema().

File

nodeapi_example/nodeapi_example.install, line 25
Nodeapi example module's install and uninstall code.

Code

function nodeapi_example_schema() {
  $schema['nodeapi_example'] = array(
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => t('Primary Key: Unique ID.'),
      ),
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('node id for the rating'),
      ),
      'vid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('version id for rating'),
      ),
      'rating' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('rating for this node'),
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  return $schema;
}