data_node.install in Data 6
Install hooks for Data Node module.
File
data_node/data_node.installView source
<?php
/**
* @file
* Install hooks for Data Node module.
*/
/**
* Implementation of hook_schema().
*/
function data_node_schema() {
$schema = array();
$schema['data_table_node'] = array(
'description' => 'Relate data records to nodes',
'fields' => array(
'nid' => array(
'type' => 'int',
'size' => 'normal',
'unsigned' => TRUE,
'not null' => TRUE,
),
'data_table_name' => array(
'type' => 'varchar',
'size' => 'normal',
'length' => 64,
'not null' => TRUE,
),
'id' => array(
'type' => 'int',
'size' => 'normal',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'indexes' => array(
'nid' => array(
'nid',
),
'data_table_name' => array(
'data_table_name',
),
'id' => array(
'id',
),
'name_id' => array(
'data_table_name',
'id',
),
),
'primary key' => array(
'nid',
'data_table_name',
'id',
),
);
return $schema;
}
/**
* Implementation of hook_install().
*/
function data_node_install() {
drupal_install_schema('data_node');
}
/**
* Implementation of hook_uninstall().
*/
function data_node_uninstall() {
drupal_uninstall_schema('data_node');
}
/**
* Add an index to id and name.
*/
function data_node_update_6001() {
$ret = array();
db_add_index($ret, 'data_table_node', 'name_id', array(
'data_table_name',
'id',
));
return $ret;
}
Functions
Name | Description |
---|---|
data_node_install | Implementation of hook_install(). |
data_node_schema | Implementation of hook_schema(). |
data_node_uninstall | Implementation of hook_uninstall(). |
data_node_update_6001 | Add an index to id and name. |