This repository has been archived by the owner on Mar 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxs.install
82 lines (76 loc) · 1.85 KB
/
xs.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* @file
* Install, update and uninstall functions for the xs module.
*/
/**
* Implements hook_schema().
*/
function xs_schema() {
$schema = array();
$schema['xs_action_log'] = array(
'description' => 'Log table for XenServer Actions.',
'fields' => array(
'id' => array(
'description' => 'The primary identifier for the log.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'target_id' => array(
'description' => 'Server node id',
'type' => 'int',
'not null' => TRUE,
),
'uid' => array(
'description' => 'User who run the action',
'type' => 'int',
'not null' => TRUE,
),
'log' => array(
'description' => 'Log text',
'type' => 'varchar',
'length' => 8096,
'not null' => TRUE,
),
'type' => array(
'description' => 'Log type',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'created' => array(
'description' => 'The Unix timestamp when the log entry was created',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'log_created' => array('created'),
'log_server_id' => array('target_id'),
'log_user_id' => array('uid'),
),
'foreign keys' => array(
'target_id' => array(
'table' => 'node',
'columns' => array('target_id' => 'nid'),
),
'uid' => array(
'table' => 'users',
'columns' => array('uid' => 'uid'),
),
),
'primary key' => array('id'),
);
return $schema;
}
/**
* Creates server actions log schema.
*/
function xs_update_7001() {
$schema = xs_schema();
foreach ($schema as $table_name => $table) {
db_create_table($table_name, $table);
}
}