From d1e844841da31940514f37f1d5625d60ef7af96a Mon Sep 17 00:00:00 2001 From: GeckoLinux Date: Wed, 8 Feb 2023 22:20:46 -0500 Subject: [PATCH] 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 --- script/import_scripts/drupal.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/script/import_scripts/drupal.rb b/script/import_scripts/drupal.rb index ac01a2daa40..15bc3d8b008 100644 --- a/script/import_scripts/drupal.rb +++ b/script/import_scripts/drupal.rb @@ -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