| 1 |
<?php
|
| 2 |
|
| 3 |
// $Id: activity_log.install,v 1.3 2008/09/23 17:04:19 mercmobily Exp $
|
| 4 |
|
| 5 |
/**
|
| 6 |
* @file
|
| 7 |
* Contains install/uninstall and update functions for activity_log
|
| 8 |
*/
|
| 9 |
|
| 10 |
/**
|
| 11 |
* Implementation of hook_schema().
|
| 12 |
*/
|
| 13 |
function activity_log_schema() {
|
| 14 |
|
| 15 |
/**
|
| 16 |
* Contains relations between two users
|
| 17 |
*
|
| 18 |
*/
|
| 19 |
$schema['activity_log'] = array(
|
| 20 |
'description' => t('Table for storing activity logs by users'),
|
| 21 |
|
| 22 |
'fields' => array(
|
| 23 |
|
| 24 |
|
| 25 |
'aid' => array(
|
| 26 |
'description' => t('The activity id'),
|
| 27 |
'type' => 'serial',
|
| 28 |
'unsigned' => TRUE,
|
| 29 |
'not null' => TRUE),
|
| 30 |
|
| 31 |
'uid_creator' => array(
|
| 32 |
'description' => t('User ID of the user who created the action'),
|
| 33 |
'type' => 'int',
|
| 34 |
'unsigned' => TRUE,
|
| 35 |
'not null' => TRUE,
|
| 36 |
'default' => 0,
|
| 37 |
),
|
| 38 |
|
| 39 |
|
| 40 |
'verb' => array(
|
| 41 |
'description' => t('The verb string'),
|
| 42 |
'type' => 'varchar',
|
| 43 |
'length' => 35,
|
| 44 |
'not null' => TRUE,
|
| 45 |
'default' => ''
|
| 46 |
),
|
| 47 |
'verb_you' => array(
|
| 48 |
'description' => t('The verb to be used when the user is "you"'),
|
| 49 |
'type' => 'varchar',
|
| 50 |
'length' => 35,
|
| 51 |
'not null' => TRUE,
|
| 52 |
'default' => ''
|
| 53 |
),
|
| 54 |
|
| 55 |
'action' => array(
|
| 56 |
'description' => t('The action string'),
|
| 57 |
'type' => 'varchar',
|
| 58 |
'length' => 255,
|
| 59 |
'not null' => TRUE,
|
| 60 |
'default' => ''
|
| 61 |
),
|
| 62 |
'action_multiple' => array(
|
| 63 |
'description' => t('The action string when there are multiple items'),
|
| 64 |
'type' => 'varchar',
|
| 65 |
'length' => 255,
|
| 66 |
'not null' => TRUE,
|
| 67 |
'default' => ''
|
| 68 |
),
|
| 69 |
'action_multiple_separator' => array(
|
| 70 |
'description' => t('The separator when there are multiple actions'),
|
| 71 |
'type' => 'varchar',
|
| 72 |
'length' => 25,
|
| 73 |
'not null' => TRUE,
|
| 74 |
'default' => ''
|
| 75 |
),
|
| 76 |
|
| 77 |
|
| 78 |
'activity_timestamp' => array(
|
| 79 |
'description' => t('The activity\'s timestamp'),
|
| 80 |
'type' => 'int',
|
| 81 |
'unsigned' => TRUE,
|
| 82 |
'not null' => TRUE,
|
| 83 |
'default' => 0,
|
| 84 |
),
|
| 85 |
|
| 86 |
),
|
| 87 |
'primary key' => array('aid'),
|
| 88 |
|
| 89 |
'indexes' => array(
|
| 90 |
'uid_creator' => array('uid_creator'),
|
| 91 |
'action' => array('action'),
|
| 92 |
'verb' => array('verb'),
|
| 93 |
'activity_timestamp' => array('activity_timestamp'),
|
| 94 |
),
|
| 95 |
|
| 96 |
|
| 97 |
);
|
| 98 |
|
| 99 |
$schema['activity_log_targets'] = array(
|
| 100 |
'description' => t('Table for storing activity logs targets'),
|
| 101 |
|
| 102 |
'fields' => array(
|
| 103 |
|
| 104 |
|
| 105 |
'atid' => array(
|
| 106 |
'description' => t('The activity target id'),
|
| 107 |
'type' => 'serial',
|
| 108 |
'unsigned' => TRUE,
|
| 109 |
'not null' => TRUE),
|
| 110 |
|
| 111 |
|
| 112 |
'aid' => array(
|
| 113 |
'description' => t('The activity id'),
|
| 114 |
'type' => 'int',
|
| 115 |
'unsigned' => TRUE,
|
| 116 |
'not null' => TRUE,
|
| 117 |
'default' => 0,
|
| 118 |
),
|
| 119 |
|
| 120 |
'uid_target' => array(
|
| 121 |
'description' => t('The target user'),
|
| 122 |
'type' => 'int',
|
| 123 |
'unsigned' => TRUE,
|
| 124 |
'not null' => TRUE,
|
| 125 |
'default' => 0,
|
| 126 |
),
|
| 127 |
'oid_target_type' => array(
|
| 128 |
'description' => t('The target type'),
|
| 129 |
'type' => 'varchar',
|
| 130 |
'length' => 10,
|
| 131 |
'not null' => TRUE,
|
| 132 |
'default' => ''
|
| 133 |
),
|
| 134 |
'oid_target' => array(
|
| 135 |
'description' => t('Object ID of the target'),
|
| 136 |
'type' => 'int',
|
| 137 |
'unsigned' => TRUE,
|
| 138 |
'not null' => TRUE,
|
| 139 |
),
|
| 140 |
|
| 141 |
|
| 142 |
'target_timestamp' => array(
|
| 143 |
'description' => t('The activity\'s timestamp'),
|
| 144 |
'type' => 'int',
|
| 145 |
'unsigned' => TRUE,
|
| 146 |
'not null' => TRUE,
|
| 147 |
'default' => 0,
|
| 148 |
),
|
| 149 |
|
| 150 |
|
| 151 |
),
|
| 152 |
'primary key' => array('atid'),
|
| 153 |
|
| 154 |
'indexes' => array(
|
| 155 |
'target_timestamp' => array('target_timestamp'),
|
| 156 |
'aid' => array('aid'),
|
| 157 |
'uid_target' => array('uid_target'),
|
| 158 |
'oid_target_type' => array('oid_target_type'),
|
| 159 |
'oid_target' => array('oid_target'),
|
| 160 |
),
|
| 161 |
|
| 162 |
|
| 163 |
);
|
| 164 |
|
| 165 |
return $schema;
|
| 166 |
}
|
| 167 |
|
| 168 |
/**
|
| 169 |
* Implementation of hook_install().
|
| 170 |
*/
|
| 171 |
function activity_log_install() {
|
| 172 |
// Create tables
|
| 173 |
drupal_install_schema('activity_log');
|
| 174 |
#drupal_set_message("Results: $r1 , $r2");
|
| 175 |
|
| 176 |
}
|
| 177 |
|
| 178 |
/**
|
| 179 |
* Implementation of hook_uninstall().
|
| 180 |
*/
|
| 181 |
function activity_log_uninstall() {
|
| 182 |
// Remove tables
|
| 183 |
drupal_uninstall_schema('activity_log');
|
| 184 |
}
|