forked from Islandora/islandora_solr_metadata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
islandora_solr_metadata.install
172 lines (167 loc) · 5.21 KB
/
islandora_solr_metadata.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
/**
* @file
* Implementations of installation hooks.
*/
/**
* Implements hook_schema().
*/
function islandora_solr_metadata_schema() {
$schema['islandora_solr_metadata_associations'] = array(
'description' => 'Table that stores saved configuration names.',
'fields' => array(
'configuration_id' => array(
'description' => 'Unique ID given to each association',
'type' => 'serial',
'length' => 11,
'not null' => TRUE,
),
'configuration_name' => array(
'description' => 'The name of the configuration which this field belongs to',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'description_field' => array(
'type' => 'varchar',
'length' => 255,
'default' => NULL,
'description' => 'The field name as indexed in Solr to be used for displaying description metadata',
),
'description_label' => array(
'type' => 'varchar',
'length' => 255,
'description' => 'The label for the description metadata',
'default' => NULL,
),
'machine_name' => array(
'type' => 'varchar',
'length' => 255,
'description' => 'The machine readable name for this association',
'not null' => TRUE,
),
),
'primary key' => array('configuration_id'),
);
$schema['islandora_solr_metadata_fields'] = array(
'description' => 'Table that stores Islandora Solr Metadata field settings.',
'fields' => array(
'configuration_id' => array(
'type' => 'int',
'length' => 11,
'not null' => TRUE,
'description' => 'The ID of the configuration which this field belongs to',
),
'solr_field' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'The field name as indexed in Solr',
),
'display_label' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'The display label of the field for output',
),
'hyperlink' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'date_format' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The date format used for dates.',
),
'permissions' => array(
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'A serialized array of name value pairs that store permissions field settings.',
),
'structured_data' => array(
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'A serialized array containing a namespace, prefix and value to be used for marking up data for SEO.',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Weight of the field within field type.',
),
),
'primary key' => array('configuration_id', 'solr_field'),
);
$schema['islandora_solr_metadata_cmodels'] = array(
'description' => 'Table that stores content models associated to configurations',
'fields' => array(
'configuration_id' => array(
'type' => 'int',
'length' => 11,
'not null' => TRUE,
'description' => 'The ID of the configuration which this field belongs to',
),
'cmodel' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'The name of the content model assigned to this configuration',
),
),
'primary_key' => array('configuration_id', 'cmodel'),
);
return $schema;
}
/**
* Implements hook_uninstall().
*/
function islandora_solr_metadata_uninstall() {
$variables = array(
'islandora_solr_metadata_omit_empty_values',
'islandora_solr_metadata_dedup_values',
);
array_walk($variables, 'variable_del');
}
/**
* Add the hyperlink column to the database going forward.
*/
function islandora_solr_metadata_update_7100() {
db_add_field('islandora_solr_metadata_fields', 'hyperlink', array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
));
}
/**
* Add additional columns needed to give new configuration options.
*/
function islandora_solr_metadata_update_7101() {
db_add_field('islandora_solr_metadata_fields', 'permissions', array(
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'A serialized array of name value pairs that store permissions field settings.',
));
db_add_field('islandora_solr_metadata_fields', 'date_format', array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The PHP date format used for dates.',
));
db_add_field('islandora_solr_metadata_fields', 'structured_data', array(
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'A serialized array containing a namespace, prefix and value to be used for marking up data for SEO.',
));
}