community_tags.install in Community Tags 6
Same filename and directory in other branches
The install file for the community_tags module.
File
community_tags.installView source
<?php
/**
* @file
* The install file for the community_tags module.
*/
/**
* Implementation of hook_install().
*/
function community_tags_install() {
// Install schema
drupal_install_schema('community_tags');
// Drop module weight so we act after taxonomy.
$weight = (int) db_result(db_query("SELECT weight FROM {system} WHERE name = 'taxonomy'"));
db_query("UPDATE {system} SET weight = %d WHERE name = 'community_tags'", $weight + 1);
}
/**
* Implementation of hook_uninstall().
*/
function community_tags_uninstall() {
drupal_uninstall_schema('community_tags');
}
/**
* Implementation of hook_schema().
*/
function community_tags_schema() {
$schema['community_tags'] = array(
'fields' => array(
'tid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'date' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'tid' => array(
'tid',
),
'nid' => array(
'nid',
),
'uid' => array(
'uid',
),
'tid_nid' => array(
'tid',
'nid',
),
),
'primary key' => array(
'tid',
'uid',
'nid',
),
);
return $schema;
}
/**
* Update: Add tid column key.
*/
function community_tags_update_1() {
$ret = array();
db_add_index($ret, 'community_tags', 'tid', array(
'tid',
));
return $ret;
}
/**
* Implementation of hook_enable().
*/
function community_tags_enable() {
}
/**
* Update: Add tid_nid 2 column index.
*/
function community_tags_update_6001() {
$ret = array();
db_add_index($ret, 'community_tags', 'tid_nid', array(
'tid',
'nid',
));
return $ret;
}
Functions
Name | Description |
---|---|
community_tags_enable | Implementation of hook_enable(). |
community_tags_install | Implementation of hook_install(). |
community_tags_schema | Implementation of hook_schema(). |
community_tags_uninstall | Implementation of hook_uninstall(). |
community_tags_update_1 | Update: Add tid column key. |
community_tags_update_6001 | Update: Add tid_nid 2 column index. |