node_limit_interval.install in Node Limit 6
Same filename and directory in other branches
Installation functions for module node_limit_interval.
File
node_limit_interval/node_limit_interval.installView source
<?php
/**
* @file
* Installation functions for module node_limit_interval.
*/
/**
* Implementation of hook_install().
*/
function node_limit_interval_install() {
drupal_install_schema('node_limit_interval');
}
/**
* Implementation of hook_schema().
*/
function node_limit_interval_schema() {
$schema['node_limit_interval'] = array(
'description' => t('The table for applying node limits to a time interval'),
'fields' => array(
'lid' => array(
'description' => t('The {node_limit}.lid'),
'type' => 'int',
'not null' => TRUE,
),
'interval' => array(
'description' => t('The interval for this limit'),
'type' => 'int',
'not null' => TRUE,
),
'unit' => array(
'description' => t('The unit for the interval'),
'type' => 'int',
'not null' => TRUE,
),
),
'primary key' => array(
'lid',
),
);
return $schema;
}
/**
* Renaming limit field to avoid mysql restricted name usage
*/
function node_limit_interval_update_6001() {
// Cannot use db_change_field() because of the restricted name
$ret = db_query("ALTER TABLE {node_limit_interval} CHANGE `interval` `ninterval` INT(11) NOT NULL DEFAULT '0' COMMENT 'The interval for this limit'");
return !empty($ret);
}
/*
* Implementation of hook_uninstall().
*/
function node_limit_interval_uninstall() {
drupal_uninstall_schema('node_limit_interval');
}
Functions
Name | Description |
---|---|
node_limit_interval_install | Implementation of hook_install(). |
node_limit_interval_schema | Implementation of hook_schema(). |
node_limit_interval_uninstall | |
node_limit_interval_update_6001 | Renaming limit field to avoid mysql restricted name usage |