1 -- This file should undo anything in `up.sql`
2 CREATE OR REPLACE FUNCTION post_aggregates_post ()
7 IF (TG_OP = 'INSERT') THEN
8 INSERT INTO post_aggregates (post_id, published, newest_comment_time, newest_comment_time_necro)
9 VALUES (NEW.id, NEW.published, NEW.published, NEW.published);
10 ELSIF (TG_OP = 'DELETE') THEN
11 DELETE FROM post_aggregates
12 WHERE post_id = OLD.id;
18 ALTER TABLE post_aggregates
19 DROP COLUMN community_id,
20 DROP COLUMN creator_id;