function node_example_schema in Examples for Developers 6
Implementation of hook_schema().
File
- node_example/
node_example.install, line 25 - Node example module's install and uninstall code.
Code
function node_example_schema() {
$schema['node_example'] = array(
'fields' => array(
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'color' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'quantity' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'vid',
'nid',
),
);
return $schema;
}