From 8c8c9623e7b7d5980b32e0264c12268ff6e34ace Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Sat, 6 Jun 2026 00:00:32 +0000 Subject: [PATCH] Remove the ARRIVALS_A.ArAID column and use EID as the primary key --- db/schemas/lib/triggers/create/arrivals_a.m4 | 6 ++--- .../sokwedb/indexes/create/arrivals_a.m4 | 5 ----- db/schemas/sokwedb/indexes/drop/arrivals_a.m4 | 3 --- .../sokwedb/tables/create/arrivals_a.m4 | 5 +++-- doc/diagrams/events.svg | 22 ++----------------- doc/src/epilog.inc.m4 | 2 -- doc/src/tables/arrivals_a.m4 | 11 +--------- 7 files changed, 9 insertions(+), 45 deletions(-) diff --git a/db/schemas/lib/triggers/create/arrivals_a.m4 b/db/schemas/lib/triggers/create/arrivals_a.m4 index 35ba84a..2ba8d2b 100644 --- a/db/schemas/lib/triggers/create/arrivals_a.m4 +++ b/db/schemas/lib/triggers/create/arrivals_a.m4 @@ -36,7 +36,7 @@ CREATE OR REPLACE FUNCTION arrivals_a_func () `The Meme Factory, Inc., www.karlpinc.com') IF TG_OP = 'UPDATE' THEN - cannot_change(`ARRIVALS_A', `ArAID') + cannot_change(`ARRIVALS_A', `EID') END IF; -- The EVENTS.Behavior must be sdb_arrival @@ -74,8 +74,8 @@ CREATE OR REPLACE FUNCTION arrivals_a_func () , DETAIL = 'Arrivals at the feeding station can only be related' || ' to an event with an' || ' EVENTS.Behavior value of (sdb_arrival_a)' - || ': Key (AArID = (' - || NEW.aarid + || ': Key (EID = (' + || NEW.eid || '): Value (Cycle) = (' || NEW.cycle || '): Value (DataSource) = (' diff --git a/db/schemas/sokwedb/indexes/create/arrivals_a.m4 b/db/schemas/sokwedb/indexes/create/arrivals_a.m4 index 8d8c9c3..c455fa5 100644 --- a/db/schemas/sokwedb/indexes/create/arrivals_a.m4 +++ b/db/schemas/sokwedb/indexes/create/arrivals_a.m4 @@ -21,11 +21,6 @@ include(`copyright.m4')dnl include(`constants.m4')dnl include(`indexmacros.m4')dnl -CREATE UNIQUE INDEX IF NOT EXISTS - "ARRIVALS_A has, at most, a 1-to-1 relationship with EVENTS" - ON arrivals_a - (eid); - CREATE INDEX IF NOT EXISTS arrivals_a_swelling ON arrivals_a (swelling); diff --git a/db/schemas/sokwedb/indexes/drop/arrivals_a.m4 b/db/schemas/sokwedb/indexes/drop/arrivals_a.m4 index 912e732..90320a6 100644 --- a/db/schemas/sokwedb/indexes/drop/arrivals_a.m4 +++ b/db/schemas/sokwedb/indexes/drop/arrivals_a.m4 @@ -21,7 +21,4 @@ include(`copyright.m4')dnl include(`constants.m4')dnl include(`indexmacros.m4')dnl -DROP INDEX IF EXISTS - "ARRIVALS_A has, at most, a 1-to-1 relationship with EVENTS"; - DROP INDEX IF EXISTS arrivals_a_swelling; diff --git a/db/schemas/sokwedb/tables/create/arrivals_a.m4 b/db/schemas/sokwedb/tables/create/arrivals_a.m4 index 03f28eb..3daa82d 100644 --- a/db/schemas/sokwedb/tables/create/arrivals_a.m4 +++ b/db/schemas/sokwedb/tables/create/arrivals_a.m4 @@ -24,8 +24,7 @@ include(`grants.m4')dnl dnl CREATE TABLE arrivals_a ( - key_column(`ARRIVALS_A', `ArAID', INTEGER) - ,eid INTEGER NOT NULL + eid INTEGER NOT NULL REFERENCES events ,seq INTEGER NOT NULL positive_check(`Seq') @@ -55,4 +54,6 @@ CREATE TABLE arrivals_a ( CHECK(recorder <> observer2) ); +eid_primary_key(`ARRIVALS_A') + grant_priv(`ARRIVALS_A') diff --git a/doc/diagrams/events.svg b/doc/diagrams/events.svg index 7602540..40d4f5f 100644 --- a/doc/diagrams/events.svg +++ b/doc/diagrams/events.svg @@ -822,7 +822,7 @@ inkscape:pageshadow="2" inkscape:zoom="3.6096384" inkscape:cx="643.8318" - inkscape:cy="615.15857" + inkscape:cy="725.97299" inkscape:document-units="mm" inkscape:current-layer="layer3" inkscape:document-rotation="0" @@ -2960,7 +2960,7 @@ + transform="translate(102.38751,129.6)"> - ArAID - ` -.. |ARRIVALS_A.ArAID| - replace:: :ref:`ArAID ` .. |ARRIVALS_A.EID| replace:: :ref:`EID ` .. |ARRIVALS_A.Seq| diff --git a/doc/src/tables/arrivals_a.m4 b/doc/src/tables/arrivals_a.m4 index 71ac5b8..b76e380 100644 --- a/doc/src/tables/arrivals_a.m4 +++ b/doc/src/tables/arrivals_a.m4 @@ -64,16 +64,6 @@ The |ARRIVALS_A.Recorder| value may not be the same as the :depth: 2 -.. _ARRIVALS_A.ArAID: - -ArAID (Arrivals_A ID) -````````````````````` - -.. |ARRIVALS_A.ArAID_summary| replace:: |idcol| - -|ARRIVALS_A.ArAID_summary| |notnull| - - .. _ARRIVALS_A.EID: EID (Event ID) @@ -83,6 +73,7 @@ EID (Event ID) The |EVENTS|.\ |EVENTS.EID| identifying the feeding station arrival event that is related to the arrival and departure. + |idcol| |ARRIVALS_A.EID_summary| The related event contains information on arrival and departure times. -- 2.34.1