From 6df80fb39a737fcce67fd601f155489f9dc8a763 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Fri, 5 Jun 2026 19:33:13 +0000 Subject: [PATCH] Remove the GROOM_SCANS_B.GsID column and use EID as the primary key --- .../lib/triggers/create/groom_scans_b.m4 | 9 +++--- db/schemas/sokwedb/indexes/Makefile | 2 +- .../sokwedb/indexes/create/groom_scans_b.m4 | 29 ------------------- .../sokwedb/indexes/drop/groom_scans_b.m4 | 25 ---------------- .../sokwedb/tables/create/groom_scans_b.m4 | 5 ++-- doc/diagrams/events.svg | 22 ++------------ doc/src/epilog.inc.m4 | 2 -- doc/src/tables/groom_scans_b.m4 | 11 +------ 8 files changed, 11 insertions(+), 94 deletions(-) delete mode 100644 db/schemas/sokwedb/indexes/create/groom_scans_b.m4 delete mode 100644 db/schemas/sokwedb/indexes/drop/groom_scans_b.m4 diff --git a/db/schemas/lib/triggers/create/groom_scans_b.m4 b/db/schemas/lib/triggers/create/groom_scans_b.m4 index 6c82493..b61c9a2 100644 --- a/db/schemas/lib/triggers/create/groom_scans_b.m4 +++ b/db/schemas/lib/triggers/create/groom_scans_b.m4 @@ -36,12 +36,11 @@ CREATE OR REPLACE FUNCTION groom_scans_b_func () `The Meme Factory, Inc., www.karlpinc.com') IF TG_OP = 'UPDATE' THEN - cannot_change(`GROOM_SCANS_B', `GrID') + cannot_change(`GROOM_SCANS_B', `EID') END IF; -- The EVENTS.Behavior must be sdb_groom_scan - IF TG_OP = 'INSERT' - OR NEW.eid <> OLD.eid THEN + IF TG_OP = 'INSERT' THEN DECLARE -- EVENTS a_behavior events.behavior%TYPE; @@ -73,8 +72,8 @@ CREATE OR REPLACE FUNCTION groom_scans_b_func () MESSAGE = 'Error on ' || TG_OP || ' of GROOM_SCANS_B' , DETAIL = 'Groom_Scans_B can only be related to an event with an' || ' EVENTS.Behavior value of (sdb_groom_scan)' - || ': Key (GrID = (' - || NEW.grid + || ': Key (EID = (' + || NEW.eid || '): Value (Initiator) = (' || textualize(`NEW.initiator') || '): Value (Terminator) = (' diff --git a/db/schemas/sokwedb/indexes/Makefile b/db/schemas/sokwedb/indexes/Makefile index a4399ec..cc52eaf 100644 --- a/db/schemas/sokwedb/indexes/Makefile +++ b/db/schemas/sokwedb/indexes/Makefile @@ -22,7 +22,7 @@ ORDER := biography_data biography_log comm_membs comm_memb_log \ follows follow_observers follow_studies events roles arrivals \ swelling_sources swelling_states aggression_event_log sightings \ - aggressions food_events groomings groom_scans_b attendance \ + aggressions food_events groomings attendance \ arrivals_a ## diff --git a/db/schemas/sokwedb/indexes/create/groom_scans_b.m4 b/db/schemas/sokwedb/indexes/create/groom_scans_b.m4 deleted file mode 100644 index cf041df..0000000 --- a/db/schemas/sokwedb/indexes/create/groom_scans_b.m4 +++ /dev/null @@ -1,29 +0,0 @@ -dnl Copyright (C) 2026 The Meme Factory, Inc., http://www.karlpinc.com/ -dnl -dnl This program is free software: you can redistribute it and/or modify -dnl it under the terms of the GNU Affero General Public License as published -dnl by the Free Software Foundation, either version 3 of the License, or -dnl (at your option) any later version. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU Affero General Public License for more details. -dnl -dnl You should have received a copy of the GNU Affero General Public License -dnl along with this program. If not, see . -dnl -dnl Karl O. Pinc -dnl -dnl -dnl m4 includes -include(`copyright.m4')dnl -include(`constants.m4')dnl -include(`indexmacros.m4')dnl - -CREATE UNIQUE INDEX IF NOT EXISTS - "GROOM_SCANS_B has, at most, a 1-to-1 releationship with EVENTS" - ON groom_scans_b - (eid); --- We won't index ExtractedBy because this is not expected to be --- frequently searched. diff --git a/db/schemas/sokwedb/indexes/drop/groom_scans_b.m4 b/db/schemas/sokwedb/indexes/drop/groom_scans_b.m4 deleted file mode 100644 index 9fe5fd2..0000000 --- a/db/schemas/sokwedb/indexes/drop/groom_scans_b.m4 +++ /dev/null @@ -1,25 +0,0 @@ -dnl Copyright (C) 2026 The Meme Factory, Inc., http://www.karlpinc.com/ -dnl -dnl This program is free software: you can redistribute it and/or modify -dnl it under the terms of the GNU Affero General Public License as published -dnl by the Free Software Foundation, either version 3 of the License, or -dnl (at your option) any later version. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU Affero General Public License for more details. -dnl -dnl You should have received a copy of the GNU Affero General Public License -dnl along with this program. If not, see . -dnl -dnl Karl O. Pinc -dnl -dnl -dnl m4 includes -include(`copyright.m4')dnl -include(`constants.m4')dnl -include(`indexmacros.m4')dnl - -DROP INDEX IF EXISTS - "GROOM_SCANS_B has, at most, a 1-to-1 releationship with EVENTS"; diff --git a/db/schemas/sokwedb/tables/create/groom_scans_b.m4 b/db/schemas/sokwedb/tables/create/groom_scans_b.m4 index 52f3558..dafb923 100644 --- a/db/schemas/sokwedb/tables/create/groom_scans_b.m4 +++ b/db/schemas/sokwedb/tables/create/groom_scans_b.m4 @@ -24,8 +24,7 @@ include(`grants.m4')dnl dnl CREATE TABLE groom_scans_b ( - key_column(`GROOM_SCANS_B', `GSID', INTEGER) - ,eid INTEGER NOT NULL + eid INTEGER NOT NULL REFERENCES events ,others BOOLEAN NOT NULL ,duplicate BOOLEAN NOT NULL @@ -33,4 +32,6 @@ CREATE TABLE groom_scans_b ( REFERENCES people ); +eid_primary_key(`GROOM_SCANS_B') + grant_priv(`GROOM_SCANS_B') diff --git a/doc/diagrams/events.svg b/doc/diagrams/events.svg index 7a1a29c..3d88b1b 100644 --- a/doc/diagrams/events.svg +++ b/doc/diagrams/events.svg @@ -822,7 +822,7 @@ inkscape:pageshadow="2" inkscape:zoom="3.6096384" inkscape:cx="242.68359" - inkscape:cy="770.29876" + inkscape:cy="903.27607" inkscape:document-units="mm" inkscape:current-layer="layer3" inkscape:document-rotation="0" @@ -1825,7 +1825,7 @@ + transform="matrix(1.0000018,0,0,1.0041489,-11.156763,189.77816)"> - GSID - ` .. |GROOM_SCANS_B| replace:: :ref:`GROOM_SCANS_B ` -.. |GROOM_SCANS_B.GSID| replace:: - :ref:`GSID ` .. |GROOM_SCANS_B.EID| replace:: :ref:`EID ` .. |GROOM_SCANS_B.Others| replace:: diff --git a/doc/src/tables/groom_scans_b.m4 b/doc/src/tables/groom_scans_b.m4 index e7b5131..3013ff4 100644 --- a/doc/src/tables/groom_scans_b.m4 +++ b/doc/src/tables/groom_scans_b.m4 @@ -64,16 +64,6 @@ table. :depth: 2 -.. _GROOM_SCANS_B.GSID: - -GSID (Grooming Scan ID) -``````````````````````` - -.. |GROOM_SCANS_B.GSID_summary| replace:: |idcol| - -|GROOM_SCANS_B.GSID_summary| |notnull| - - .. _GROOM_SCANS_B.EID: EID (Event ID) @@ -81,6 +71,7 @@ EID (Event ID) .. |GROOM_SCANS_B.EID_summary| replace:: The |EVENTS|.\ |EVENTS.EID| identifying the groom sampling event. + |idcol| |GROOM_SCANS_B.EID_summary| The related event contains information on the time of the grooming -- 2.34.1