Commit 0fd332e7 authored by jaydub's avatar jaydub Committed by fago
Browse files

Issue #1839744 by jaydub: Add index on {$field_collection_field()}_revision_id() column.

parent da9c2297
......@@ -84,6 +84,9 @@ function field_collection_field_schema($field) {
);
return array(
'columns' => $columns,
'indexes' => array(
'revision_id' => array('revision_id'),
),
);
}
......@@ -260,3 +263,21 @@ function field_collection_update_7003() {
// Need to get the system up-to-date so drupal_schema_fields_sql() will work.
$schema = drupal_get_schema('field_collection_item_revision', TRUE);
}
/**
* Add index on {$field_collection_field}_revision_id column for all tables.
*/
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.
db_add_index($table, $revision_id_column, array($revision_id_column));
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment