Fix occasional bug in order of imported comments (#20204)

This bug is actually a Drupal issue where some edited posts have their `created` and `changed` timestamps set to the same value. But even when that happens in Drupal it still maintains the correct post order in an affected thread. This PR makes the Discourse importer also maintain the original Drupal comment order by sorting comments in the source DB by their `cid`, which is sequential and never changes. More details from this post onward:
https://meta.discourse.org/t/large-drupal-forum-migration-importer-errors-and-limitations/246939/24?u=rahim123
This commit is contained in:
GeckoLinux 2023-02-08 22:20:46 -05:00 committed by GitHub
parent fc166258d3
commit d1e844841d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -223,6 +223,7 @@ class ImportScripts::Drupal < ImportScripts::Base
AND c.status = 1
AND n.type IN ('blog', 'forum')
AND n.status = 1
ORDER BY c.cid ASC
LIMIT #{BATCH_SIZE}
OFFSET #{offset}
SQL