Comment migration working? (D5 --> D7) View displaying comments not 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.
Things I learned today, yes it took me all day, and I learned a lot. Like to test your assumptions. Test them early and verify the problem you're trying to solve in fact is in the place you are looking.

My debacle outlined above was completely separate from all the comment tables. The maddening part, was I narrowed it down to the comment bodies not appearing (or so I thought) because I was using a view to display the author's name, followed by the comment. Where this view pulled the author name from was the comment table, where the author's name wasn't was in the users table, I hadn't run the user migration in a couple weeks &amp; enough users had joined &amp; commented that, well, you get the picture. 

Also contributing to the madness was the lack of information in the error messages, I kept getting malformed entity exceptions, which is probably because I was using views to display the comments.

Something else I noticed, that a comment's initial changed time is a few seconds before it's created time, not sure that's a bug, but definitely a quirk.