function field_collection_update_7004 in Field collection 7
Add index on {$field_collection_field}_revision_id column for all tables.
File
- ./
field_collection.install, line 276 - Install, update and uninstall functions for the field_collection module.
Code
function field_collection_update_7004() {
// Update the field_collection_field_schema columns for all tables.
foreach (field_read_fields(array(
'type' => 'field_collection',
)) as $field_name => $field) {
$table_prefixes = array(
'field_data',
'field_revision',
);
foreach ($table_prefixes as $table_prefix) {
$table = sprintf('%s_%s', $table_prefix, $field_name);
$revision_id_column = sprintf('%s_revision_id', $field_name);
// Add index on revision_id column.
if (!db_index_exists($table, $revision_id_column)) {
db_add_index($table, $revision_id_column, array(
$revision_id_column,
));
}
}
}
}