diff --git a/gossamer_forums.rb b/gossamer_forums.rb index 014ce2d..1227322 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1,5 +1,5 @@ # gossamer threads migration-import code -# v0.31 +# v0.31.1 require 'mysql2' require 'open-uri' @@ -1190,7 +1190,7 @@ class GossamerForumsImporter < ImportScripts::Base puts "Highest processed personal_id: #{highest_processed_personal_id}" # OVERRIDE - to speed getting to problem msg -# highest_processed_personal_id = 350 + highest_processed_personal_id = 1543840 puts "Highest processed personal_id override: #{highest_processed_personal_id}" execute_query("SELECT * FROM gforum_Message").each do |row| @@ -1223,11 +1223,15 @@ class GossamerForumsImporter < ImportScripts::Base sanitized_title = "" if sanitized_title.nil? || sanitized_title.empty? # Check for an existing private message topic between the same two users with a similar title - topic = Topic.joins(:topic_allowed_users, :custom_fields) - .where(archetype: Archetype.private_message) +# topic = Topic.joins(:topic_allowed_users, :custom_fields) +# .where(archetype: Archetype.private_message) +# .where("topic_allowed_users.user_id = ? AND topic_allowed_users.user_id = ?", from_user_id, to_user_id) +# .where("title = ? OR title = ?", sanitized_title, "Re: #{sanitized_title}") +# .where(topic_custom_fields: { name: 'original_gossamer_msg_id' }) +# .first + topic = Topic.where.joins(:topic_allowed_users) .where("topic_allowed_users.user_id = ? AND topic_allowed_users.user_id = ?", from_user_id, to_user_id) .where("title = ? OR title = ?", sanitized_title, "Re: #{sanitized_title}") - .where(topic_custom_fields: { name: 'original_gossamer_msg_id' }) .first if topic.nil?