FEATURE: fix consistency of users.last_posted_at in importers

This commit is contained in:
Régis Hanol 2014-09-08 19:36:55 +02:00
parent 4f6b9815ae
commit 9964955e88
1 changed files with 6 additions and 0 deletions

View File

@ -73,6 +73,7 @@ class ImportScripts::Base
puts ""
update_bumped_at
update_last_posted_at
update_feature_topic_users
update_category_featured_topics
update_topic_count_replies
@ -466,6 +467,11 @@ class ImportScripts::Base
Post.exec_sql("update topics t set bumped_at = (select max(created_at) from posts where topic_id = t.id and post_type != #{Post.types[:moderator_action]})")
end
def update_last_posted_at
puts "", "updaing last posted at on users"
User.exec_sql("UPDATE users SET last_posted_at = (SELECT MAX(posts.created_at) FROM posts WHERE posts.user_id = users.id)")
end
def update_feature_topic_users
puts "", "updating featured topic users"