Bound by custom field name

This commit is contained in:
Nat 2025-03-25 17:02:18 +08:00
parent bfb0e87012
commit 64567d9766
No known key found for this signature in database
GPG Key ID: 4938B35D927EC773
2 changed files with 8 additions and 2 deletions

View File

@ -6,7 +6,10 @@ class CopySolvedTopicCustomFieldToDiscourseSolvedSolvedTopics < ActiveRecord::Mi
BATCH_SIZE = 10_000
def up
max_id = DB.query_single("SELECT MAX(id) FROM topic_custom_fields").first
max_id =
DB.query_single(
"SELECT MAX(id) FROM topic_custom_fields WHERE topic_custom_fields.name = 'accepted_answer_post_id'",
).first
return unless max_id
last_id = 0

View File

@ -8,7 +8,10 @@ class CopyRemainingSolvedTopicCustomFieldToDiscourseSolvedSolvedTopics < ActiveR
BATCH_SIZE = 5000
def up
max_id = DB.query_single("SELECT MAX(id) FROM topic_custom_fields").first
max_id =
DB.query_single(
"SELECT MAX(id) FROM topic_custom_fields WHERE topic_custom_fields.name = 'accepted_answer_post_id'",
).first
return unless max_id
last_id = 0