empty category_tag_stats table before running init job
This commit is contained in:
parent
2cf40096d1
commit
fdd8ce9722
|
@ -1,6 +1,8 @@
|
||||||
module Jobs
|
module Jobs
|
||||||
class InitCategoryTagStats < Jobs::Onceoff
|
class InitCategoryTagStats < Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
|
CategoryTagStat.exec_sql "DELETE FROM category_tag_stats"
|
||||||
|
|
||||||
CategoryTagStat.exec_sql <<~SQL
|
CategoryTagStat.exec_sql <<~SQL
|
||||||
INSERT INTO category_tag_stats (category_id, tag_id, topic_count)
|
INSERT INTO category_tag_stats (category_id, tag_id, topic_count)
|
||||||
SELECT topics.category_id, tags.id, COUNT(topics.id)
|
SELECT topics.category_id, tags.id, COUNT(topics.id)
|
||||||
|
|
Loading…
Reference in New Issue