How to migrate taxonomy with hierarchy?
I had to migrate a nested Vocabulary from Drupal 6 to Drupal 7. My Strategy was:


Migrate the plain terms
Use the postImport() of Migrate-API to map the Parent-Relationship

public function postImport() {

// Get alle Terms from features_dd_private_contact_form_subjects
// Query zum Laden der Daten aus Drupal6
$source_query = Database::getConnection('legacy', 'legacy')
  -&gt;select('term_data', 't');

// Join Terms with voab
$source_query-&gt;join('vocabulary', 'v', 'v.vid = t.vid');

// Join Hierarchy
$source_query-&gt;join('term_hierarchy', 'th', 'th.tid = t.tid');

$source_query-&gt;condition('th.parent', '0', '&lt;&gt;');

$source_query-&gt;fields('th', array());

$source_query-&gt;condition(
  'v.module',
  'features_dd_private_contact_form_subjects',
  '='
);

$source_query-&gt;fields('t');

$source_records = $source_query-&gt;execute();

foreach ($source_records as $source_record) {


  // Term-ID in destination db.
  $dest_tid = $this-&gt;get_destination_tid_by_old_tid($source_record-&gt;tid);


  // Parent-Tid in the destination.
  $dest_parent_tid = $this-&gt;get_destination_tid_by_old_tid($source_record-&gt;parent);

  $child_term = taxonomy_term_load($dest_tid);
  $child_term-&gt;parent = $dest_parent_tid;
  taxonomy_term_save($child_term);
}


}