I thought I had this piece of the migration sorted, but I'm not sure what's off. As far as I know these are the places comment info is stored:
- comment
- field_data_comment_body
- field_revision_comment_body
- node_comment_statistics
I'm using a stored procedure to migrate the comments from the D5 db to the first three tables in the above list, the data appears to match what's generated by the native comment submission. After the stored procedure I run devel_rebuild_node_comment_statistics();
The results in the node_comment_statistics table look promising but some comments (rather their record in this table) are missing, or (after typing this all out) I'm realizing that this table probably doesn't store a record for every comment, just the last comment for that node (and comment count, etc).
Regardless, some comments won't display, even though their db records appear the same as neighboring comments that do display. I suspect this has to do with a subtle change in how the comment hierarchy is stored?
Also, (could be coincidence), one of the MIA comments did not have a record in the node_comment_statistics table, but this may be normal/works as designed.
The SQL statement within devel_rebuild_node_comment_statistics();
MIGHT be part of my issue (not blaming the function because it may not have been designed for how i'm using it) here is the function's SQL:
SELECT c.nid, c.cid, c.created, c.name, c.uid, c2.comment_count FROM {comment} c
JOIN (SELECT c.nid, MAX(c.created) AS created, COUNT(*) AS comment_count FROM {comment} c WHERE STATUS = 1 GROUP BY c.nid)
AS c2 ON c.nid = c2.nid AND c.created = c2.created
Let me know if you need more info, or have an approach suggestion. Thanks!
UPDATE: So on a clean D7 install w/ devel generate, i'm seeing that a record is created not for every comment, but for every node in node_comment_statistics. The zero comment records are probably not related to my issue. Comparing the results of devel_rebuild_node_comment_statistics();
to native comment storage, everything seems fine w/ the function, so something is wonky in my comment migration.