function nodeapi_example_schema in Examples for Developers 7
Same name and namespace in other branches
- 6 nodeapi_example/nodeapi_example.install \nodeapi_example_schema()
Implements hook_schema().
Related topics
File
- nodeapi_example/
nodeapi_example.install, line 13 - Install, update and uninstall functions for the nodeapi_example module.
Code
function nodeapi_example_schema() {
$schema['nodeapi_example'] = array(
'description' => 'Stores information of extended content.',
'fields' => array(
'nid' => array(
'description' => 'Node ID that the rating is applied to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'vid' => array(
'description' => 'Revision ID, as we are tracking rating with node revisions',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'rating' => array(
'description' => 'The rating of the node.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'vid',
),
'indexes' => array(
'nid' => array(
'nid',
),
),
);
return $schema;
}