Add metatags import to migration I have made a migration module to import the full content from a legacy Drupal 6 site to my new Drupal 7 site, using the migrate d2d module. Everything works fine, but I have just discovered that there are many custom meta tags added manually for both nodes and taxonomy in the legacy site (using the Metatags module). The taxonomy meta tags I can deal with manually, but I really would need to figure out how to add the mapping for metatags in my node migration classes. Do I add code in my general migration class in node.inc (that extends DrupalNode6Migration)?

Do I use prepareRow() to fetch info from the database and add this to a mapping with a default value in the new site? As far as I can see there are no fields in the legacy site that holds the metatags (I need title, keywords and description).

If anyone knows how to do this, please help.
Finally I came up with a solution and I post it here in case anyone else has the same problem. There are two tables in the legacy site named metatags and  metapages, in which you can find everything needed for importing the metatags. 

So in my prepareRow() in each node migration class I added these rows, and now the metatags from the legacy Drual 6 site has been imported to my Drupal 7 site :-)

$metapages_path = !empty($row-&gt;nid) ? 'node/'.$row-&gt;nid : false;
if($metapages_path){
    $meta_title_pid = Database::getConnection($target='default', $key='legacy')-&gt;query('SELECT f.title, f.pid FROM {metapages} f WHERE f.path = :path',array(':path' =&gt; $metapages_path))-&gt;fetchAssoc();
}
$meta_title = !empty($meta_title_pid['title']) ? $meta_title_pid['title'] . ' | [site:name]' : '';
$this-&gt;addFieldMapping('metatag_title')-&gt;defaultValue($meta_title); 
$meta_pid = !empty($meta_title_pid['pid']) ? $meta_title_pid['pid'] : false;
if($meta_pid){
    $meta_keywords = Database::getConnection($target='default', $key='legacy')-&gt;query('SELECT f.value FROM {metatags} f WHERE f.name = :key AND f.parent_pid = :pid',array(':pid' =&gt; $meta_pid, 'key' =&gt; 'keywords'))-&gt;fetchAssoc();
    $meta_description = Database::getConnection($target='default', $key='legacy')-&gt;query('SELECT f.value FROM {metatags} f WHERE f.name = :key AND f.parent_pid = :pid',array(':pid' =&gt; $meta_pid, 'key' =&gt; 'description'))-&gt;fetchAssoc();      
}
$keywords = !empty($meta_keywords['value']) ? $meta_keywords['value'] : '';
$this-&gt;addFieldMapping('metatag_keywords')-&gt;defaultValue($keywords);    
$description = !empty($meta_description['value']) ? $meta_description['value'] : '';
$this-&gt;addFieldMapping('metatag_description')-&gt;defaultValue($description);