From 9f3ddf06b4786abc651fa83102ac7f71d35727ad Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Sun, 5 Oct 2025 15:54:42 +0000 Subject: [PATCH] Prevent EVENTS.FID from changing If the FID is allowed to change, at minimum -- there may be other cases, the check that ROLES.Participant must be under study becomes complicated. It would require code in the triggers to trace the BIOGRAPHY_DATA.Animid <- ROLES.Participant -> EVENTS.EID --> FOLLOWS.FID chain to check FOLLOWS.Date against biography. Simpler to dis-allow change. --- db/schemas/lib/triggers/create/events.m4 | 8 ++++++++ doc/src/tables/events.m4 | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/db/schemas/lib/triggers/create/events.m4 b/db/schemas/lib/triggers/create/events.m4 index ed80fe1..670216b 100644 --- a/db/schemas/lib/triggers/create/events.m4 +++ b/db/schemas/lib/triggers/create/events.m4 @@ -39,6 +39,14 @@ CREATE OR REPLACE FUNCTION events_func () -- Allowing the EID to change makes life too complicated. cannot_change(`EVENTS', `EID') + -- If the FID is allowed to change, at minimum -- there may be other + -- cases, the check that ROLES.Participant must be under study + -- becomes complicated. It would require code in the triggers + -- to trace the BIOGRAPHY_DATA.Animid <- ROLES.Participant -> + -- EVENTS.EID --> FOLLOWS.FID chain to check FOLLOWS.Date + -- against biography. Simpler to dis-allow change. + cannot_change(`EVENTS', `FID') + -- If the Behavior is allowed to change, we need to add code here -- that checks all the tables related to the participants and the -- various event detail tables. This is way too much code; it is diff --git a/doc/src/tables/events.m4 b/doc/src/tables/events.m4 index 7f04d26..54e7f10 100644 --- a/doc/src/tables/events.m4 +++ b/doc/src/tables/events.m4 @@ -112,7 +112,7 @@ FID (Follow IDentifier) The |FOLLOWS|.\ |FOLLOWS.FID| that identifies the follow during which the event was recorded. -|EVENTS.FID_summary| |notnull| +|EVENTS.FID_summary| |cannot_change| |notnull| .. _EVENTS.Behavior: -- 2.34.1