From 2bcd88a40d0c969cf3bfd736007723e8d772106e Mon Sep 17 00:00:00 2001 From: saint Date: Thu, 4 Jul 2024 23:29:16 +1000 Subject: [PATCH] v0.27.1 Workaround for odd topic validation issue --- gossamer_forums.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gossamer_forums.rb b/gossamer_forums.rb index d10116c..42b05d8 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1,5 +1,5 @@ # gossamer threads migration-import code -# v0.27 +# v0.27.1 require 'mysql2' require 'open-uri' @@ -1098,7 +1098,11 @@ class GossamerForumsImporter < ImportScripts::Base # end @db.execute("SELECT * FROM topic_last_post_time").each do |row| topic_id, last_post_time = row - Topic.find(topic_id).update!( +# Validation error: Topic.find(topic_id).update!( + topic = Topic.find(topic_id) + + # Ensure we are only updating necessary fields + topic.update_columns( updated_at: Time.at(last_post_time), posts_count: fetch_db_topic_post_count(topic_id).to_i, last_posted_at: Time.at(last_post_time),