]> Untitled Git - lemmy.git/blob - migrations/2023-07-26-222023_site-aggregates-one/down.sql
remove n^2 part of person triggers, improve community aggregate trigger (#3739)
[lemmy.git] / migrations / 2023-07-26-222023_site-aggregates-one / down.sql
1 create or replace function site_aggregates_site()
2 returns trigger language plpgsql
3 as $$
4 begin
5   IF (TG_OP = 'INSERT') THEN
6     insert into site_aggregates (site_id) values (NEW.id);
7   ELSIF (TG_OP = 'DELETE') THEN
8     delete from site_aggregates where site_id = OLD.id;
9   END IF;
10   return null;
11 end $$;