diff --git a/core/modules/taxonomy/taxonomy.install b/core/modules/taxonomy/taxonomy.install index afce334..868801c 100644 --- a/core/modules/taxonomy/taxonomy.install +++ b/core/modules/taxonomy/taxonomy.install @@ -204,10 +204,14 @@ function taxonomy_field_schema($field) { */ function taxonomy_update_dependencies() { // Convert the 'tid' column of the taxonomy reference field to 'target_id' - // after fields and instances have been moved to the config system. + // after fields and instances have been moved to the config system... $dependencies['taxonomy'][8007] = array( 'field' => 8003, ); + // ... but before the field storage tables are renamed. + $dependencies['field'][8006] = array( + 'taxonomy' => 8007, + ); return $dependencies; } @@ -362,15 +366,15 @@ function taxonomy_update_8007() { $field_config = config($config_name); // Only update taxonomy reference fields that use the default SQL storage. if ($field_config->get('type') == 'taxonomy_term_reference') { - $field = new Field($field_config->get()); + $field_name = $field_config->get('name'); $tables = array( - DatabaseStorageController::_fieldTableName($field), - DatabaseStorageController::_fieldRevisionTableName($field), + 'field_data_' . $field_name, + 'field_revision_' . $field_name, ); foreach ($tables as $table_name) { - db_change_field($table_name, $field->name . '_tid', $field->name . '_target_id', array( + db_change_field($table_name, $field_name . '_tid', $field_name . '_target_id', array( 'description' => 'The ID of the target entity.', 'type' => 'int', 'unsigned' => TRUE, @@ -378,8 +382,8 @@ function taxonomy_update_8007() { )); // Change the index. - db_drop_index($table_name, $field->name . '_tid'); - db_add_index($table_name, $field->name . '_target_id', array($field->name . '_target_id')); + db_drop_index($table_name, $field_name . '_tid'); + db_add_index($table_name, $field_name . '_target_id', array($field_name . '_target_id')); } // Update the indexes in field config as well.