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