| 1 |
<?php
|
| 2 |
// $Id: timemap.install,v 1.1 2008/06/02 03:43:49 sethfreach Exp $
|
| 3 |
|
| 4 |
|
| 5 |
/**
|
| 6 |
* Implementation of hook_schema().
|
| 7 |
*/
|
| 8 |
function timemap_schema() {
|
| 9 |
$schema['timemap_doings'] = array(
|
| 10 |
'description' => t('table that stores the entries'),
|
| 11 |
'fields' => array(
|
| 12 |
'did' => array(
|
| 13 |
'description' => t('doing ID'),
|
| 14 |
'type' => 'serial',
|
| 15 |
'unsigned' => TRUE,
|
| 16 |
'not null' => TRUE,
|
| 17 |
),
|
| 18 |
'uid' => array(
|
| 19 |
'description' => t('user uid'),
|
| 20 |
'type' => 'int',
|
| 21 |
'unsigned' => TRUE,
|
| 22 |
'not null' => TRUE,
|
| 23 |
'default' => 0,
|
| 24 |
),
|
| 25 |
'cid' => array(
|
| 26 |
'description' => t('category cid'),
|
| 27 |
'type' => 'int',
|
| 28 |
'not null' => TRUE,
|
| 29 |
'default' => 0,
|
| 30 |
),
|
| 31 |
'task' => array(
|
| 32 |
'description' => t('actual text entered'),
|
| 33 |
'type' => 'varchar',
|
| 34 |
'length' => 255,
|
| 35 |
'not null' => TRUE,
|
| 36 |
'default' => '',
|
| 37 |
),
|
| 38 |
'time' => array(
|
| 39 |
'description' => t('timestamp start'),
|
| 40 |
'type' => 'int',
|
| 41 |
'unsigned' => TRUE,
|
| 42 |
'not null' => TRUE,
|
| 43 |
'default' => 0,
|
| 44 |
),
|
| 45 |
'stop' => array(
|
| 46 |
'description' => t('timestamp stop'),
|
| 47 |
'type' => 'int',
|
| 48 |
'unsigned' => TRUE,
|
| 49 |
'not null' => TRUE,
|
| 50 |
'default' => 0,
|
| 51 |
),
|
| 52 |
),
|
| 53 |
'indexes' => array(
|
| 54 |
'uid' => array('uid'),
|
| 55 |
),
|
| 56 |
'primary key' => array('did'),
|
| 57 |
);
|
| 58 |
|
| 59 |
$schema['timemap_categories'] = array(
|
| 60 |
'description' => t('Categories that tasks can fall into'),
|
| 61 |
'fields' => array(
|
| 62 |
'cid' => array(
|
| 63 |
'description' => t('category ID'),
|
| 64 |
'type' => 'serial',
|
| 65 |
'unsigned' => TRUE,
|
| 66 |
'not null' => TRUE,
|
| 67 |
),
|
| 68 |
'uid' => array(
|
| 69 |
'description' => t('user uid'),
|
| 70 |
'type' => 'int',
|
| 71 |
'unsigned' => TRUE,
|
| 72 |
'not null' => TRUE,
|
| 73 |
'default' => 0,
|
| 74 |
),
|
| 75 |
'category' => array(
|
| 76 |
'description' => t('text name of the category'),
|
| 77 |
'type' => 'varchar',
|
| 78 |
'length' => 255,
|
| 79 |
'not null' => TRUE,
|
| 80 |
'default' => '',
|
| 81 |
),
|
| 82 |
'active' => array(
|
| 83 |
'description' => t('off / on switch'),
|
| 84 |
'type' => 'int',
|
| 85 |
'size' => 'tiny',
|
| 86 |
'unsigned' => TRUE,
|
| 87 |
'not null' => TRUE,
|
| 88 |
'default' => 1,
|
| 89 |
),
|
| 90 |
),
|
| 91 |
'indexes' => array(
|
| 92 |
'uid' => array('uid'),
|
| 93 |
'active' => array('active'),
|
| 94 |
),
|
| 95 |
'primary key' => array('cid'),
|
| 96 |
);
|
| 97 |
|
| 98 |
$schema['timemap_catcolor'] = array(
|
| 99 |
'description' => t('colors to assign categories'),
|
| 100 |
'fields' => array(
|
| 101 |
'ccid' => array(
|
| 102 |
'description' => t('category color ID'),
|
| 103 |
'type' => 'serial',
|
| 104 |
'unsigned' => TRUE,
|
| 105 |
'not null' => TRUE,
|
| 106 |
),
|
| 107 |
'cid' => array(
|
| 108 |
'description' => t('category ID'),
|
| 109 |
'type' => 'int',
|
| 110 |
'unsigned' => TRUE,
|
| 111 |
'not null' => TRUE,
|
| 112 |
'default' => 0,
|
| 113 |
),
|
| 114 |
'uid' => array(
|
| 115 |
'description' => t('user UID'),
|
| 116 |
'type' => 'int',
|
| 117 |
'unsigned' => TRUE,
|
| 118 |
'not null' => TRUE,
|
| 119 |
'default' => 0,
|
| 120 |
),
|
| 121 |
'hex' => array(
|
| 122 |
'description' => t('hex value of color'),
|
| 123 |
'type' => 'char',
|
| 124 |
'not null' => TRUE,
|
| 125 |
'default' => ffffff,
|
| 126 |
),
|
| 127 |
),
|
| 128 |
'indexes' => array(
|
| 129 |
'uid' => array('uid'),
|
| 130 |
),
|
| 131 |
'primary key' => array('ccid'),
|
| 132 |
);
|
| 133 |
|
| 134 |
return $schema;
|
| 135 |
}
|
| 136 |
|
| 137 |
function timemap_install() {
|
| 138 |
// Create tables.
|
| 139 |
drupal_install_schema('timemap');
|
| 140 |
}
|
| 141 |
|
| 142 |
/**
|
| 143 |
* Implementation of hook_uninstall().
|
| 144 |
*/
|
| 145 |
function timemap_uninstall() {
|
| 146 |
// Remove tables.
|
| 147 |
drupal_uninstall_schema('timemap');
|
| 148 |
|
| 149 |
}
|