mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 19:42:25 +08:00
Merge pull request #1556 from eriko/patch-1
Update 20131017014509_add_post_count_to_categories.rb
This commit is contained in:
commit
4bf064c3c6
@ -3,7 +3,7 @@ class AddPostCountToCategories < ActiveRecord::Migration
|
||||
add_column :categories, :post_count, :integer, null: false, default: 0
|
||||
execute <<SQL
|
||||
UPDATE categories
|
||||
SET post_count = (SELECT SUM(posts_count) FROM topics
|
||||
SET post_count = (SELECT COALESCE(SUM(posts_count),0) FROM topics
|
||||
WHERE category_id = categories.id AND deleted_at IS NULL)
|
||||
SQL
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user