diff -u b/core/modules/taxonomy/taxonomy.install b/core/modules/taxonomy/taxonomy.install --- b/core/modules/taxonomy/taxonomy.install +++ b/core/modules/taxonomy/taxonomy.install @@ -199,15 +199,12 @@ /** * Add unpublished nodes to the taxonomy index table. */ -function taxonomy_update_8702(&$sandbox) { +function taxonomy_update_8602(&$sandbox) { if (!isset($sandbox['total'])) { // Initialize state for future calls. $sandbox['last'] = 0; $sandbox['count'] = 0; - // Truncate table to avoid integrity constraint violation errors. - db_truncate('taxonomy_index'); - $query = db_select('node_field_data', 'n') ->condition('n.status', NODE_NOT_PUBLISHED); $sandbox['total'] = $query->countQuery()->execute()->fetchField(); @@ -227,6 +224,9 @@ // Build the taxonomy index for each node. foreach ($records as $record) { $node = node_load($record->nid); + + // Delete node index to avoid integrity constraint violation errors. + taxonomy_delete_node_index($node); taxonomy_build_node_index($node); $sandbox['last'] = $record->nid; }