v0.27.1 Workaround for odd topic validation issue

This commit is contained in:
David Sainty 2024-07-04 23:29:16 +10:00
parent b341ca3f51
commit 2bcd88a40d

View File

@ -1,5 +1,5 @@
# gossamer threads migration-import code # gossamer threads migration-import code
# v0.27 # v0.27.1
require 'mysql2' require 'mysql2'
require 'open-uri' require 'open-uri'
@ -1098,7 +1098,11 @@ class GossamerForumsImporter < ImportScripts::Base
# end # end
@db.execute("SELECT * FROM topic_last_post_time").each do |row| @db.execute("SELECT * FROM topic_last_post_time").each do |row|
topic_id, last_post_time = 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), updated_at: Time.at(last_post_time),
posts_count: fetch_db_topic_post_count(topic_id).to_i, posts_count: fetch_db_topic_post_count(topic_id).to_i,
last_posted_at: Time.at(last_post_time), last_posted_at: Time.at(last_post_time),