mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
16 lines
494 B
Plaintext
16 lines
494 B
Plaintext
create or replace function public.webhook_notify() returns trigger as
|
|
$BODY$
|
|
begin
|
|
IF (TG_OP = 'DELETE') THEN
|
|
perform pg_notify('webhookupdates', concat('REMOVE ', old.wiki));
|
|
return old;
|
|
ELSIF (TG_OP = 'INSERT') then
|
|
perform pg_notify('webhookupdates', concat('ADD ', new.wiki));
|
|
return new;
|
|
end if;
|
|
end;
|
|
$BODY$
|
|
language plpgsql;
|
|
|
|
CREATE TRIGGER RCGCDB_WEBHOOK_UPDATE BEFORE INSERT OR DELETE ON rcgcdw
|
|
FOR EACH ROW EXECUTE FUNCTION webhook_notify(); |