| Project: | Migrate |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Surprised no one got to this yet.
When trying to import comments, i get this error:
* user warning: Table 'matadortravel_6.migrate_files' doesn't exist query: _migrate_xlat_get_new_id /* admin : _migrate_xlat_get_new_id */ SELECT DISTINCT mf.importtable, mc.colname FROM migrate_content_sets mcs INNER JOIN migrate_files mf ON mcs.mfid=mf.mfid INNER JOIN migrate_columns mc ON mf.mfid=mc.mfid AND chosenpk=1 WHERE mcs.contenttype='node' in /var/www/devroots/d6-matadortravel-com/sites/all/modules/migrate/migrate.module on line 328.
* user warning: Table 'matadortravel_6.migrate_files' doesn't exist query: _migrate_xlat_get_new_id /* admin : _migrate_xlat_get_new_id */ SELECT DISTINCT mf.importtable, mc.colname FROM migrate_content_sets mcs INNER JOIN migrate_files mf ON mcs.mfid=mf.mfid INNER JOIN migrate_columns mc ON mf.mfid=mc.mfid AND chosenpk=1 WHERE mcs.contenttype='user' in /var/www/devroots/d6-matadortravel-com/sites/all/modules/migrate/migrate.module on line 328.
seems the problem is _migrate_xlat_get_new_id(), which is referencing tables that don't exist anymore. I checked against CVS and it looks like i have the updated version of comments.inc. With the ability to just add the *_map table now (which is working AWESOME, BTW, cheers mike!) It doesn't seem that we need this function (at least do do imports). Comment is trying to use this function to find the old node id and user id, but by adding the relationship, we can supply them directly.
I'm going to hack it to work along these lines, will submit patch when done. If someone is already working on this please let me know ;)
Mike, if you still see a need for _migrate_xlat_get_new_id(), maybe a different issue for that?
Comments
#1
Ahhh. As the TODO in the function comment suggests, this function is well behind the times - I forgot that comment migration uses it. It's not as simple as just substituting Table Wizard table names for the old Migrate versions, this broke when I went from migrating using tables directly to using views. A little bit of work here...
Thanks.
#2
OK here is the patch, removing the xlat stuff, using a complete hook for the cleanup code, and using comment_migrate instead of migrate_migrate.
#3
using a view source with the *_node_map and *_user_map relationships added, and then adding the nodeid and userid fields, this seems to work fine. A little more work on the tw/views end, but it seems to work well. Might be cool to automatically add these relationships somehow, not sure how that would be done though.
#4
here is the actual file for those with patch difficulties (remove the _.txt first and replace it in the migrate/supported dir.
NOTE: it doesn't do any translations from old to new on it's own, you have to add the mapped fields to your view first.
ADDING THE COMMENT TABLE IN TW
start by adding your old_comments table to tw and analyzing it. Set the old user id (uid) and the old node id (nid) in tw's relationships to their matches, *_user_map.uid and *_node_map.uid respectively.
HOW TO FILTER TO GET WHAT YOU NEED:
Your old cms may have anonymous comments (as drupal does), so you don't want to waste time trying to import them along with valid users. You also don't want to import comments on items that you haven't imported. To accomplish this, you can set filters on the old_comments table view, so you can limit importing comments to only people who have already been imported and has a nodes that exists:
(mapped) userid isset
(mapped) nodeid isset
you can also get the leftover comments and store them as anonymous comments by cloning that view and changing the filters to
userid is NOT set
nodeid isset
CONTENT SETS
These can (and should) be separate content sets and can be processed in either order.
#5
Patch re-roll and fixes for new db structure. It works pretty well for me I must say and fixes the warnings about the migrate_files database table not existing.
#6
Committed, thanks! I've opened a new ticket for the automated mapping part of this:
#529236: Automatically map nodes and users on comment import
#7
Automatically closed -- issue fixed for 2 weeks with no activity.