From 8f3a324a83f89e0b39527391fcf38021bff06551 Mon Sep 17 00:00:00 2001 From: pranav-super Date: Tue, 8 Oct 2024 15:02:10 -0700 Subject: [PATCH] external_event duration nonnegative check --- .../sql/tables/merlin/external_events/external_event.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/deployment/postgres-init-db/sql/tables/merlin/external_events/external_event.sql b/deployment/postgres-init-db/sql/tables/merlin/external_events/external_event.sql index b83dc08136..e8aeee8877 100644 --- a/deployment/postgres-init-db/sql/tables/merlin/external_events/external_event.sql +++ b/deployment/postgres-init-db/sql/tables/merlin/external_events/external_event.sql @@ -41,6 +41,12 @@ comment on column merlin.external_event.properties is e'' 'Any properties or additional data associated with this version that a data originator may have wanted included.\n' 'This column is used primarily for documentation purposes, and has no associated functionality.'; +create trigger check_external_event_duration_is_nonnegative_trigger +before insert or update on merlin.external_event +for each row +when (new.duration < '0') +execute function util_functions.raise_duration_is_negative(); + create function merlin.check_event_times() returns trigger language plpgsql as $$