diff --git a/field_collection.install b/field_collection.install index adb6225..7296346 100644 --- a/field_collection.install +++ b/field_collection.install @@ -331,9 +331,32 @@ function field_collection_update_7006() { } /** - * Update fields in field collections already set to use Entity Translation. + * Add index on {$field_collection_field}_value column for all tables. */ function field_collection_update_7007() { + foreach (field_read_fields(array('type' => 'field_collection')) as $field_name => $field) { + if (!isset($field['indexes']['value'])) { + // Add index on the value column and update the field. + $field['indexes']['value'] = array('value'); + field_update_field($field); + } + + $table_prefixes = array('field_data', 'field_revision'); + foreach ($table_prefixes as $table_prefix) { + $table = "{$table_prefix}_{$field_name}"; + $value_column = "{$field_name}_value"; + if (!db_index_exists($table, $value_column)) { + // Add index on the value column. + db_add_index($table, $value_column, array($value_column)); + } + } + } +} + +/** + * Update fields in field collections already set to use Entity Translation. + */ +function field_collection_update_7008() { // Include FieldCollectionItemEntity class. module_load_include('inc', 'field_collection', 'field_collection.entity'); @@ -358,26 +381,3 @@ function field_collection_update_7007() { } } } - -/** - * Add index on {$field_collection_field}_value column for all tables. - */ -function field_collection_update_7007() { - foreach (field_read_fields(array('type' => 'field_collection')) as $field_name => $field) { - if (!isset($field['indexes']['value'])) { - // Add index on the value column and update the field. - $field['indexes']['value'] = array('value'); - field_update_field($field); - } - - $table_prefixes = array('field_data', 'field_revision'); - foreach ($table_prefixes as $table_prefix) { - $table = "{$table_prefix}_{$field_name}"; - $value_column = "{$field_name}_value"; - if (!db_index_exists($table, $value_column)) { - // Add index on the value column. - db_add_index($table, $value_column, array($value_column)); - } - } - } -}