mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: ensure CategoryUser consistency
This commit is contained in:
parent
bbe139a7d4
commit
2b9b29c8c8
@ -13,6 +13,7 @@ module Jobs
|
||||
UserStat.update_view_counts(13.hours.ago)
|
||||
Topic.ensure_consistency!
|
||||
Badge.ensure_consistency!
|
||||
CategoryUser.ensure_consistency!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -92,6 +92,10 @@ class CategoryUser < ActiveRecord::Base
|
||||
)
|
||||
end
|
||||
|
||||
def self.ensure_consistency!
|
||||
exec_sql("DELETE FROM category_users WHERE user_id NOT IN (SELECT id FROM users)")
|
||||
end
|
||||
|
||||
private_class_method :apply_default_to_topic, :remove_default_from_topic
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user