| 1 |
<?php
|
| 2 |
// $Id: annotate.install,v 1.6 2008/08/11 12:36:57 clemenstolboom Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_schema()
|
| 6 |
*/
|
| 7 |
function annotate_schema() {
|
| 8 |
$schema['annotations'] = array(
|
| 9 |
'description' => 'stores notes on a one note per user per node base.',
|
| 10 |
'fields' => array(
|
| 11 |
'uid' => array('type' => 'int', 'unsigned' => true, 'not null' => true, 'default' => 0),
|
| 12 |
'nid' => array('type' => 'int', 'unsigned' => true, 'not null' => true, 'default' => 0),
|
| 13 |
'visibility' => array('type' => 'int', 'unsigned' => true, 'default' => 0),
|
| 14 |
'note_format' => array('type' => 'int', 'unsigned' => true, 'default' => 0),
|
| 15 |
'note' => array('type' => 'text', 'not null' => true),
|
| 16 |
'timestamp' => array('type' => 'int', 'unsigned' => true, 'not null' => true, 'default' => 0),
|
| 17 |
),
|
| 18 |
'indexes' => array(
|
| 19 |
'uid' => array('uid'),
|
| 20 |
'nid' => array('nid'),
|
| 21 |
),
|
| 22 |
'primary key' => array('uid', 'nid', 'timestamp'),
|
| 23 |
);
|
| 24 |
|
| 25 |
return $schema;
|
| 26 |
}
|
| 27 |
|
| 28 |
function annotate_update_6100() {
|
| 29 |
$ret = array();
|
| 30 |
db_drop_primary_key($ret, 'annotations');
|
| 31 |
db_add_primary_key($ret, 'annotations', array('uid', 'nid', 'timestamp'));
|
| 32 |
return $ret;
|
| 33 |
}
|
| 34 |
|
| 35 |
/**
|
| 36 |
* Implementation of hook_install()
|
| 37 |
*/
|
| 38 |
function annotate_install() {
|
| 39 |
drupal_install_schema('annotate');
|
| 40 |
}
|
| 41 |
|
| 42 |
/**
|
| 43 |
* Implementation of hook_uninstall()
|
| 44 |
*/
|
| 45 |
function annotate_uninstall() {
|
| 46 |
variable_del('annotate_show_expanded');
|
| 47 |
variable_del('annotate_nodetypes');
|
| 48 |
variable_del('annotate_nodetypes_multiple');
|
| 49 |
|
| 50 |
drupal_uninstall_schema('annotate');
|
| 51 |
}
|