| 1 |
<?php
|
| 2 |
// $Id: modr8.install,v 1.3 2008/03/03 02:59:20 pwolanin Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_schema().
|
| 6 |
*/
|
| 7 |
function modr8_schema() {
|
| 8 |
$schema['modr8_log'] = array(
|
| 9 |
'fields' => array(
|
| 10 |
'modid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
|
| 11 |
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
|
| 12 |
'uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
|
| 13 |
'author_uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
|
| 14 |
'action' => array('type' => 'varchar', 'length' => 16, 'not null' => TRUE, 'default' => ''),
|
| 15 |
'title' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
|
| 16 |
'message' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE),
|
| 17 |
'teaser' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE),
|
| 18 |
'timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
|
| 19 |
),
|
| 20 |
'indexes' => array(
|
| 21 |
'nid_time' => array('nid', 'modid'),
|
| 22 |
'action' => array('action')
|
| 23 |
),
|
| 24 |
'primary key' => array('modid'),
|
| 25 |
);
|
| 26 |
|
| 27 |
return $schema;
|
| 28 |
}
|
| 29 |
|
| 30 |
/**
|
| 31 |
* Implementation of hook_install().
|
| 32 |
*/
|
| 33 |
function modr8_install() {
|
| 34 |
// Create tables.
|
| 35 |
drupal_install_schema('modr8');
|
| 36 |
}
|
| 37 |
|
| 38 |
/**
|
| 39 |
* Implementation of hook_uninstall().
|
| 40 |
*/
|
| 41 |
function modr8_uninstall() {
|
| 42 |
// Remove tables.
|
| 43 |
drupal_uninstall_schema('modr8');
|
| 44 |
}
|
| 45 |
|
| 46 |
/**
|
| 47 |
* Update table definitions.
|
| 48 |
*/
|
| 49 |
function modr8_update_1000() {
|
| 50 |
$ret = array();
|
| 51 |
$name = 'modr8_log';
|
| 52 |
$table = array(
|
| 53 |
'fields' => array(
|
| 54 |
'modid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
|
| 55 |
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
|
| 56 |
'uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
|
| 57 |
'author_uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
|
| 58 |
'action' => array('type' => 'varchar', 'length' => 16, 'not null' => TRUE, 'default' => ''),
|
| 59 |
'title' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
|
| 60 |
'message' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE),
|
| 61 |
'teaser' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE),
|
| 62 |
'timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
|
| 63 |
),
|
| 64 |
'indexes' => array(
|
| 65 |
'nid_time' => array('nid', 'modid'),
|
| 66 |
'action' => array('action')
|
| 67 |
),
|
| 68 |
'primary key' => array('modid'),
|
| 69 |
);
|
| 70 |
db_create_table($ret, $name, $table);
|
| 71 |
return $ret;
|
| 72 |
}
|