-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot_commit.install
85 lines (81 loc) · 2.29 KB
/
bot_commit.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
83
84
85
<?php
/**
* Implementation of hook_schema().
*/
function bot_commit_schema() {
$schema = array();
$schema['bot_commit_queue'] = array(
'description' => 'Queue commits until the bot cron can go through them and post.',
'fields' => array(
'qid' => array(
'description' => 'A unique ID for this commit.',
'not null' => TRUE,
'size' => 'big',
'type' => 'serial',
'unsigned' => TRUE,
),
'id' => array(
'description' => 'An ID relevant for this commit, not necessarily unique. Provided by the user during the remote call.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'author' => array(
'description' => 'Author of the commit',
'type' => 'text',
'default' => '',
'not null' => TRUE,
),
'message' => array(
'description' => 'Commit message',
'type' => 'text',
'default' => '',
'not null' => TRUE,
),
'repo' => array(
'description' => 'Repository name',
'type' => 'varchar',
'length' => 127,
'default' => '',
'not null' => TRUE,
),
'timestamp' => array(
'description' => 'Time when this commit was received, will be used by bot cron.',
'type' => 'int',
'default' => 0,
'not null' => TRUE,
'unsigned' => TRUE,
),
'url' => array(
'description' => 'URL to be displayed when the bot spits out the message.',
'type' => 'varchar',
'length' => 255,
'default' => '',
'not null' => TRUE,
),
),
'primary key' => array('qid'),
);
return $schema;
}
/**
* Implementation of hook_install().
*/
function bot_commit_install() {
drupal_install_schema('bot_commit');
}
function bot_commit_uninstall() {
drupal_uninstall_schema('bot_commit');
}
/**
* Implementing hook_update_N().
*
* Adding new url field to queue table.
*/
function bot_commit_update_6001() {
$ret = array();
$schema = bot_commit_schema();
db_add_field($ret, 'bot_commit_queue', 'url', $schema['bot_commit_queue']['fields']['url']);
return $ret;
}