db: build the comments count column
This commit is contained in:
parent
988a9fb1a1
commit
f54f4d0afd
10
db/20180923004309-comment-count-build.sql
Normal file
10
db/20180923004309-comment-count-build.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
-- Build the comments count column
|
||||||
|
|
||||||
|
UPDATE pages
|
||||||
|
SET commentCount = subquery.commentCount
|
||||||
|
FROM (
|
||||||
|
SELECT COUNT(commentHex) as commentCount
|
||||||
|
FROM comments
|
||||||
|
WHERE state = 'approved'
|
||||||
|
GROUP BY (domain, path)
|
||||||
|
) as subquery;
|
Loading…
Reference in New Issue
Block a user