Newer
Older
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
* MS Credits Install File
*/
/**
* Implements hook_uninstall().
*/
function ms_credits_uninstall() {
// Delete related variables all at once.
db_delete('variable')
->condition('name', 'ms_credits_%%', 'LIKE')
->execute();
}
/**
* Implements hook_schema().
* @todo - Add an expiration field to let credits expire
* @todo - Use the products api to create product plans to allow for recurring products
*/
function ms_credits_schema() {
$schema['ms_credit_transactions'] = array(
'description' => 'Used to hold credit transactions',
'fields' => array(
'id' => array(
'type' => 'serial',
'description' => 'The unique ID (primary)',
'not null' => TRUE,
),
'uid' => array(
'description' => t('The user id'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'created' => array(
'description' => t('The timestamp for this transaction'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'expiration' => array(
'description' => t('The expiration timestamp for this transaction'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'credits' => array(
'description' => t('The number of credits added or subtracted'),
'type' => 'int',
'unsigned' => FALSE,
'not null' => TRUE,
'default' => 0,
),
'note' => array(
'type' => 'varchar',
'description' => 'A note for the transaction',
'length' => '255',
'not null' => TRUE,
),
'oid' => array(
'description' => t('The order id, if applicable'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('id'),
);
return $schema;
}
// ======================================
// Updates:
// ======================================