From e126aaccffe2d9d2495994c407bab904864ad64f Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Sun, 10 Sep 2023 19:10:46 -0500 Subject: [PATCH] The unknown individual can't be deleted or altered by regular users --- db/schemas/sokwedb/triggers/create/biography.m4 | 8 ++++++++ doc/src/tables/biography.m4 | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/db/schemas/sokwedb/triggers/create/biography.m4 b/db/schemas/sokwedb/triggers/create/biography.m4 index c08bb35..3234270 100644 --- a/db/schemas/sokwedb/triggers/create/biography.m4 +++ b/db/schemas/sokwedb/triggers/create/biography.m4 @@ -168,6 +168,11 @@ CREATE OR REPLACE FUNCTION biography_func () cannot_change(`BIOGRAPHY', `AnimID') END IF; + -- Can't change the unknown individual + IF TG_OP = 'UPDATE' THEN + restrict_special_row(`BIOGRAPHY', `AnimID', `sdb_unk') + END IF; + -- A mother must be female check_sex(`momid', `mother', sdb_female) @@ -367,6 +372,9 @@ CREATE OR REPLACE FUNCTION biography_delete_func () -- AGPL_notice(` --', `2023', `The Meme Factory, Inc., www.karlpinc.com') + -- Can't delete the unknown individual + restrict_delete(`BIOGRAPHY', `AnimID', `sdb_unk') + -- All but the youngest sibling (or siblings in the case of twins) -- must have FirstBorn of sdb_not_firstborn. check_firstborn(`OLD', `Deleting the BIOGRAPHY row') diff --git a/doc/src/tables/biography.m4 b/doc/src/tables/biography.m4 index b6133ba..1af688d 100644 --- a/doc/src/tables/biography.m4 +++ b/doc/src/tables/biography.m4 @@ -77,6 +77,10 @@ individual's earliest possible birth date (|BIOGRAPHY.BDMin|) and their |BIOGRAPHY.DepartDate|, may not be more than sdb_max_lifespan sdb_max_lifespan_units. +The row defining the unknown individual, the ``BIOGRAPHY`` row having +an |BIOGRAPHY.AnimID| value of ``sdb_unk``, is +:ref:`special ` and cannot be altered or deleted by ordinary +user accounts. .. _BIOGRAPHY.AnimID: -- 2.34.1