Fixing comment count necro-bump issue.
This commit is contained in:
parent
ccd2b9eb75
commit
8f61a148f6
1 changed files with 6 additions and 3 deletions
|
@ -66,10 +66,13 @@ as $$
|
||||||
begin
|
begin
|
||||||
IF (TG_OP = 'INSERT') THEN
|
IF (TG_OP = 'INSERT') THEN
|
||||||
update post_aggregates pa
|
update post_aggregates pa
|
||||||
set comments = comments + 1,
|
set comments = comments + 1
|
||||||
newest_comment_time = NEW.published
|
where pa.post_id = NEW.post_id;
|
||||||
where pa.post_id = NEW.post_id
|
|
||||||
-- A 2 day necro-bump limit
|
-- A 2 day necro-bump limit
|
||||||
|
update post_aggregates pa
|
||||||
|
set newest_comment_time = NEW.published
|
||||||
|
where pa.post_id = NEW.post_id
|
||||||
and published > ('now'::timestamp - '2 days'::interval);
|
and published > ('now'::timestamp - '2 days'::interval);
|
||||||
ELSIF (TG_OP = 'DELETE') THEN
|
ELSIF (TG_OP = 'DELETE') THEN
|
||||||
-- Join to post because that post may not exist anymore
|
-- Join to post because that post may not exist anymore
|
||||||
|
|
Loading…
Reference in a new issue