as 'begin notify builds_added; return null; end;' language plpgsql;
after insert on Builds execute procedure notifyBuildsAdded ;
returns trigger as 'begin notify builds_deleted; return null; end;' language plpgsql;
after delete on Builds execute procedure notifyBuildsDeleted ;
returns trigger as 'begin notify builds_restarted; return null; end;' language plpgsql;
after update on Builds for each row
when (old.finished = 1 and new.finished = 0) execute procedure notifyBuildRestarted ;
returns trigger as 'begin notify builds_cancelled; return null; end;' language plpgsql;
after update on Builds for each row
when (old.finished = 0 and new.finished = 1 and new.buildStatus = 4) execute procedure notifyBuildCancelled ;
returns trigger