Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/sql/70-swh-triggers.sql
Show All 20 Lines | |||||
-- Asynchronous notification of new origin insertions | -- Asynchronous notification of new origin insertions | ||||
create function notify_new_origin() | create function notify_new_origin() | ||||
returns trigger | returns trigger | ||||
language plpgsql | language plpgsql | ||||
as $$ | as $$ | ||||
begin | begin | ||||
perform pg_notify('new_origin', json_build_object('id', new.id)::text); | perform pg_notify('new_origin', json_build_object( | ||||
'url', new.url::text, | |||||
'type', new.type::text | |||||
)::text); | |||||
return null; | return null; | ||||
end; | end; | ||||
$$; | $$; | ||||
create trigger notify_new_origin | create trigger notify_new_origin | ||||
after insert on origin | after insert on origin | ||||
for each row | for each row | ||||
execute procedure notify_new_origin(); | execute procedure notify_new_origin(); | ||||
▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines |