dynamic_background_node.install in Dynamic Background 7
Same filename and directory in other branches
Installes the database scheme and handles install and uninstall of the module.
File
modules/dynamic_background_node/dynamic_background_node.installView source
<?php
/**
* @file
* Installes the database scheme and handles install and uninstall of the
* module.
*/
/**
* Implementation of hook_schema(), which implementes the table
* dynamic_background_node that holds information about about the pr. node
* selected image.
*
* @return array $schema
*/
function dynamic_background_node_schema() {
$schema = array();
$schema['dynamic_background_node'] = array(
'description' => t(''),
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'data' => array(
'type' => 'text',
'not null' => TRUE,
),
),
'unique keys' => array(
'vid' => array(
'vid',
),
),
'foreign keys' => array(
'node_revision' => array(
'table' => 'node_revision',
'columns' => array(
'vid' => 'vid',
),
),
),
'primary key' => array(
'nid',
'vid',
),
);
return $schema;
}
/**
* Implementation of hook_uninstall():
*/
function dynamic_background_node_uninstall() {
// Remove database table.
drupal_uninstall_schema('dynamic_background_node');
// Remove settings.
variable_del('dynamic_background_node');
variable_del('dynamic_background_css');
variable_del('dynamic_background_node_image_style');
}
/**
* Update the tables primary key to include 'vid'.
*/
function dynamic_background_node_update_7000() {
db_add_unique_key('dynamic_background_node', 'vid', array(
'vid',
));
db_drop_primary_key('dynamic_background_node');
db_add_primary_key('dynamic_background_node', array(
'nid',
'vid',
));
}
Functions
Name | Description |
---|---|
dynamic_background_node_schema | Implementation of hook_schema(), which implementes the table dynamic_background_node that holds information about about the pr. node selected image. |
dynamic_background_node_uninstall | Implementation of hook_uninstall(): |
dynamic_background_node_update_7000 | Update the tables primary key to include 'vid'. |