-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathservice_container.install
83 lines (78 loc) · 2.23 KB
/
service_container.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
<?php
/**
* @file
* Creates the following tables:
*
* - key_value
* - key_value_expire
*/
/**
* Implements hook_schema().
*/
function service_container_schema() {
$schema = array();
$schema['key_value'] = array(
'description' => 'Generic key-value storage table. See the state system for an example.',
'fields' => array(
'collection' => array(
'description' => 'A named collection of key and value pairs.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'name' => array(
'description' => 'The key of the key-value pair. As KEY is a SQL reserved keyword, name was chosen instead.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'value' => array(
'description' => 'The value.',
'type' => 'blob',
'not null' => TRUE,
'size' => 'big',
),
),
'primary key' => array('collection', 'name'),
);
$schema['key_value_expire'] = array(
'description' => 'Generic key/value storage table with an expiration.',
'fields' => array(
'collection' => array(
'description' => 'A named collection of key and value pairs.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'name' => array(
// KEY is an SQL reserved word, so use 'name' as the key's field name.
'description' => 'The key of the key/value pair.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'value' => array(
'description' => 'The value of the key/value pair.',
'type' => 'blob',
'not null' => TRUE,
'size' => 'big',
),
'expire' => array(
'description' => 'The time since Unix epoch in seconds when this item expires. Defaults to the maximum possible time.',
'type' => 'int',
'not null' => TRUE,
'default' => 2147483647,
),
),
'primary key' => array('collection', 'name'),
'indexes' => array(
'all' => array('name', 'collection', 'expire'),
'expire' => array('expire'),
),
);
return $schema;
}