All checks were successful
/ build (map[dockerfile:./services/hasura/Dockerfile name:hasura]) (push) Successful in 47s
/ build (map[dockerfile:./services/web/Dockerfile name:web]) (push) Successful in 1m47s
/ build (map[dockerfile:./services/watchers/Dockerfile name:watchers]) (push) Successful in 2m37s
/ build (map[dockerfile:./services/files/Dockerfile name:files]) (push) Successful in 2m52s
/ build (map[dockerfile:./services/api/Dockerfile name:api]) (push) Successful in 3m2s
/ build (map[dockerfile:./services/app/Dockerfile name:app]) (push) Successful in 31s
/ build (map[dockerfile:./services/tasks/Dockerfile name:tasks]) (push) Successful in 2m44s
/ deploy (push) Successful in 48s
31 lines
1 KiB
PL/PgSQL
31 lines
1 KiB
PL/PgSQL
-- Could not auto-generate a down migration.
|
|
-- Please write an appropriate down migration for the SQL below:
|
|
-- CREATE OR REPLACE FUNCTION public.increment_alerting_count()
|
|
-- RETURNS trigger
|
|
-- LANGUAGE plpgsql
|
|
-- AS $function$
|
|
-- BEGIN
|
|
-- IF NEW.reason = 'relative' THEN
|
|
-- UPDATE alert
|
|
-- SET alerting_relative_count = alerting_relative_count + 1
|
|
-- WHERE id = NEW.alert_id;
|
|
-- ELSIF NEW.reason IN ('agent', 'connect') THEN
|
|
-- UPDATE alert
|
|
-- SET alerting_connect_count = alerting_connect_count + 1
|
|
-- WHERE id = NEW.alert_id;
|
|
-- ELSIF NEW.reason = 'around' THEN
|
|
-- UPDATE alert
|
|
-- SET alerting_around_count = alerting_around_count + 1
|
|
-- WHERE id = NEW.alert_id;
|
|
-- ELSIF NEW.reason = 'self' THEN
|
|
-- -- Do nothing for 'self'
|
|
-- NULL;
|
|
-- END IF;
|
|
-- RETURN NEW;
|
|
-- END;
|
|
-- $function$;
|
|
--
|
|
-- CREATE TRIGGER update_alerting_counts
|
|
-- AFTER INSERT ON alerting
|
|
-- FOR EACH ROW
|
|
-- EXECUTE FUNCTION public.increment_alerting_count();
|