mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 14:41:25 +08:00
FIX: Calculate reaction_users_count
in the bulk import script (#30964)
`reaction_users_count` should be calculated in the import script instead of the converter.
This commit is contained in:
@ -2999,9 +2999,12 @@ class BulkImport::Generic < BulkImport::Base
|
|||||||
puts "", "Importing reactions..."
|
puts "", "Importing reactions..."
|
||||||
|
|
||||||
reactions = query(<<~SQL)
|
reactions = query(<<~SQL)
|
||||||
SELECT *
|
SELECT r.*,
|
||||||
FROM discourse_reactions_reactions
|
COALESCE((SELECT COUNT(*)
|
||||||
ORDER BY post_id, reaction_value
|
FROM discourse_reactions_reaction_users ru
|
||||||
|
WHERE ru.reaction_id = r.id), 0) as count
|
||||||
|
FROM discourse_reactions_reactions r
|
||||||
|
ORDER BY r.post_id, r.reaction_value
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
reaction_type_id = DiscourseReactions::Reaction.reaction_types["emoji"]
|
reaction_type_id = DiscourseReactions::Reaction.reaction_types["emoji"]
|
||||||
@ -3020,7 +3023,7 @@ class BulkImport::Generic < BulkImport::Base
|
|||||||
post_id: post_id,
|
post_id: post_id,
|
||||||
reaction_type: reaction_type_id,
|
reaction_type: reaction_type_id,
|
||||||
reaction_value: row["reaction_value"],
|
reaction_value: row["reaction_value"],
|
||||||
reaction_users_count: row["reaction_users_count"],
|
reaction_users_count: row["count"],
|
||||||
created_at: to_datetime(row["created_at"]),
|
created_at: to_datetime(row["created_at"]),
|
||||||
updated_at: to_datetime(row["updated_at"]),
|
updated_at: to_datetime(row["updated_at"]),
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user