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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
<?php
/**
* @file
* Muamba installation functions.
*/
/**
* Implements hook_install()
*/
function muamba_install() {
}
/**
* Implements hook_schema()
*
* @todo
* Add privatemsg thread_id into muamba table.
*/
function muamba_schema() {
$schema['muamba'] = array(
'description' => 'The base table for muamba assets.',
'fields' => array(
'mid' => array(
'description' => t('The primary identifier for a muamba transaction.'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'description' => t('The {node}.nid of the borrowed item.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'description' => t('The {user}.uid requesting an item.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'thread_id' => array(
'description' => t('The {thread}.thread_id for the transaction.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'status' => array(
'description' => t('Transaction status.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'foreign keys' => array(
'node' => array(
'table' => 'node',
'columns' => array('nid' => 'nid'),
),
'requester' => array(
'table' => 'users',
'columns' => array('uid' => 'uid'),
),
'thread' => array(
'table' => 'pm_index',
'columns' => array('thread_id' => 'thread_id'),
),
),
'primary key' => array('mid'),
);
return $schema;
}
/**
* Adds transactional fields to muamba data model.
*/
function muamba_update_7000(&$sandbox) {
// Make sure to not run this update twice.
if (db_field_exists('muamba', 'mid')) {
return;
}
db_add_field('muamba', 'mid',
array(
'description' => t('The primary identifier for a muamba transaction.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
)
);
db_add_primary_key('muamba', array('mid'));
db_add_field('muamba', 'status',
array(
'description' => t('Transaction status.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
)
);
db_add_field('muamba', 'thread_id',
array(
'description' => t('The {thread}.thread_id for the transaction.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
array(
'foreign keys' => array(
'thread' => array(
'table' => 'pm_index',
'columns' => array('thread_id' => 'thread_id'),
)
)
)
);
}
|