-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathfield_collection.install
108 lines (101 loc) · 3.08 KB
/
field_collection.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
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
<?php
/**
* @file
* Install, update and uninstall functions for the field_collection module.
*/
/**
* Implements hook_schema().
*/
function field_collection_schema() {
$schema['field_collection_item'] = array(
'description' => 'Stores information about field collection items.',
'fields' => array(
'item_id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique field collection item ID.',
),
'revision_id' => array(
'type' => 'int',
'not null' => TRUE,
'description' => 'Default revision ID.',
),
'field_name' => array(
'description' => 'The name of the field on the host entity embedding this entity.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'archived' => array(
'description' => 'Boolean indicating whether the field collection item is archived.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('item_id'),
);
$schema['field_collection_item_revision'] = array(
'description' => 'Stores revision information about field collection items.',
'fields' => array(
'revision_id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique revision ID.',
),
'item_id' => array(
'type' => 'int',
'not null' => TRUE,
'description' => 'Field collection item ID.',
),
),
'primary key' => array('revision_id'),
'indexes' => array(
'item_id' => array('item_id'),
),
'foreign keys' => array(
'versioned_field_collection_item' => array(
'table' => 'field_collection_item',
'columns' => array('item_id' => 'item_id'),
),
),
);
$schema['cache_entity_field_collection_item'] = backdrop_get_schema_unprocessed('system', 'cache');
$schema['cache_entity_field_collection_item']['description'] = 'Cache table used to store Field Collection item entity records.';
return $schema;
}
/**
* Implements hook_field_schema().
*/
function field_collection_field_schema($field) {
$columns = array(
'value' => array(
'type' => 'int',
'not null' => FALSE,
'description' => 'The field collection item id.',
),
'revision_id' => array(
'type' => 'int',
'not null' => FALSE,
'description' => 'The field collection item revision id.',
),
);
return array(
'columns' => $columns,
'indexes' => array(
'value' => array('value'),
'revision_id' => array('revision_id'),
),
);
}
/**
* Creates the table to enable caching of Field Collection item entities.
*/
function field_collection_update_1000() {
$table = backdrop_get_schema_unprocessed('system', 'cache');
$table['description'] = 'Cache table used to store Field Collection item entity records.';
if (db_table_exists('cache_entity_field_collection_item')) {
db_drop_table('cache_entity_field_collection_item');
}
db_create_table('cache_entity_field_collection_item', $table);
}