mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-17 04:01:29 -05:00
FIX: ensure CategoryUser consistency
This commit is contained in:
parent
bbe139a7d4
commit
2b9b29c8c8
2 changed files with 5 additions and 0 deletions
|
@ -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 a new issue