While migrating from Drupal 6 to Drupal 7 (into a new blank site), I noticed that files attached to comments are not handled by the Migrate module. The D6 site uses a contributed module „Comment Uploads“ that associates files with comments in a table comment_upload:
+------+------+-------+----------------------+------+--------+------------+
| fid | nid | cid | description | list | weight | legacy_fid |
+------+------+-------+----------------------+------+--------+------------+
| 1002 | 1001 | 1000 | under_149.jpg | 0 | 0 | 0 |
| 1774 | 1969 | 6855 | ruler.png | 0 | 0 | 0 |
| 1706 | 1712 | 6009 | 1.png | 1 | 127 | 0 |
| 1703 | 1712 | 6006 | 2.png | 1 | 127 | 0 |
| 1704 | 1712 | 6006 | 3.png | 1 | 127 | 0 |
Nodes, comments and files already migrated successfully to D7 using the migrate_d2d module and its user interface. Node attachments went through fine. Except comments no longer have files attached now. Since files and comments exist, it should be possible to attach the files to their original comments, using the above table.
Q: How would I go about and migrate comment attachments properly?
a) Would it make sense to hack the migration class for D6 comments? The issue is: The comment attachments do not appear as a source field in the Migrate user interface, as they do for nodes. Maybe if this could be achieved, this would be the best solution.
b) Why not grab that above table’s data (some 1000 rows only), iterate over it and call the appropriate D7 API to attach each file (fid) to its original comment (cid)? If so, which API calls should be used and where do I place this code?
Despite doing software development for decades, Drupal’s inner underpinnings are new to me. Any help is highly appreciated.
Edit: I don't want to use the Comment Upload module under D7 anymore.