mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 14:51:18 +00:00
11 lines
303 B
MySQL
11 lines
303 B
MySQL
|
create or replace function site_aggregates_site()
|
||
|
returns trigger language plpgsql
|
||
|
as $$
|
||
|
begin
|
||
|
IF (TG_OP = 'INSERT') THEN
|
||
|
insert into site_aggregates (site_id) values (NEW.id);
|
||
|
ELSIF (TG_OP = 'DELETE') THEN
|
||
|
delete from site_aggregates where site_id = OLD.id;
|
||
|
END IF;
|
||
|
return null;
|
||
|
end $$;
|