/
shrtr.install
59 lines (56 loc) · 1.24 KB
/
shrtr.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
<?php
/**
* Implements hook_schema().
*/
function shrtr_schema() {
$schema['shrtr_urls'] = array(
'description' => 'Shortened URLs',
'fields' => array(
'id' => array(
'description' => 'ID of shortened URL',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'url' => array(
'description' => 'Original URL',
'type' => 'text',
'not null' => TRUE,
'size' => 'small',
),
'created' => array(
'description' => 'Created',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'description' => 'User ID',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'expire' => array(
'description' => 'Expire time',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('id'),
);
return $schema;
}
/**
* Creates expire field.
*/
function shrtr_update_7100() {
$spec = array(
'description' => 'Exipre time',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
);
db_add_field('shrtr_urls', 'expire', $spec);
return t('Expire field added to database.');
}