-
Notifications
You must be signed in to change notification settings - Fork 0
/
sms.install
80 lines (69 loc) · 1.77 KB
/
sms.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
<?php
/**
* @file
* Install, update and uninstall functions for the smsframework module.
*/
/**
* Implements hook_install().
*/
function sms_install() {
drupal_install_schema('sms');
}
/**
* Implements hook_schema().
*/
function sms_schema() {
$schema['sms_carriers'] = array(
'fields' => array(
'name' => array('type' => 'varchar', 'not null' => TRUE, 'length' => 64),
'domain' => array('type' => 'varchar', 'not null' => TRUE, 'length' => 128),
'prefix' => array('type' => 'varchar', 'not null' => TRUE, 'length' => 128),
'receive' => array('type' => 'int', 'not null' => TRUE),
),
'primary key' => array('domain'),
);
return $schema;
}
/**
* Implements hook_update().
*
* Drop the now dead delta field, and change primary key to number.
*/
function sms_update_1() {
$ret = array();
db_drop_primary_key($ret, 'sms_user');
db_add_primary_key($ret, 'sms_user', array('number'));
db_add_index($ret, 'sms_user', 'uid', array('uid'));
db_drop_field($ret, 'sms_user', 'delta');
return $ret;
}
/**
* Implements hook_update().
*
* Drop the now dead delta field, and change primary key to number.
*/
function sms_update_2() {
$ret = array();
db_add_field($ret, 'sms_carriers', 'prefix', array('type' => 'varchar', 'not null' => TRUE, 'length' => 128));
return $ret;
}
/**
* Implements hook_update().
*
* Drop the now dead delta field, and change primary key to number.
*/
function sms_update_3() {
$ret = array();
db_add_field($ret, 'sms_carriers', 'receive', array('type' => 'int', 'not null' => TRUE));
return $ret;
}
/**
* Implements hook_uninstall().
*/
function sms_uninstall() {
drupal_uninstall_schema('sms');
$variables = array();
foreach ($variables as $variable) {
variable_del($variable);
}
}