From 822a0d65d10cedde316ff49b3beb86f46bb99a8d Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Fri, 12 Jun 2026 15:25:07 +0000 Subject: [PATCH] Create WATCHES.Type column --- conversion/load_follow_to_watches.sql | 2 ++ db/schemas/sokwedb/indexes/create/watches.m4 | 4 ++++ db/schemas/sokwedb/indexes/drop/watches.m4 | 1 + db/schemas/sokwedb/tables/create/watches.m4 | 3 +++ doc/diagrams/watches.svg | 24 ++++++++++++++++---- doc/src/epilog.inc.m4 | 6 +++-- doc/src/tables/watches.m4 | 16 +++++++++++++ include/global_constants.m4 | 7 ++++++ 8 files changed, 57 insertions(+), 6 deletions(-) diff --git a/conversion/load_follow_to_watches.sql b/conversion/load_follow_to_watches.sql index c7f9cc2..0b9be74 100644 --- a/conversion/load_follow_to_watches.sql +++ b/conversion/load_follow_to_watches.sql @@ -58,10 +58,12 @@ INSERT INTO watches ( focal , commid , date +, type , notes) SELECT fol_b_animid , fol_cl_community_id , fol_date + , 'F' , '' FROM clean.follow ORDER BY fol_b_animid, fol_date; diff --git a/db/schemas/sokwedb/indexes/create/watches.m4 b/db/schemas/sokwedb/indexes/create/watches.m4 index 35565e3..fb21926 100644 --- a/db/schemas/sokwedb/indexes/create/watches.m4 +++ b/db/schemas/sokwedb/indexes/create/watches.m4 @@ -30,3 +30,7 @@ CREATE INDEX IF NOT EXISTS watches_focal ON watches (focal); CREATE INDEX IF NOT EXISTS watches_commid ON watches (commid); +CREATE INDEX IF NOT EXISTS watches_commid ON watches + (commid); +CREATE INDEX IF NOT EXISTS watches_type ON watches + (type); diff --git a/db/schemas/sokwedb/indexes/drop/watches.m4 b/db/schemas/sokwedb/indexes/drop/watches.m4 index 6ff0f31..33e49be 100644 --- a/db/schemas/sokwedb/indexes/drop/watches.m4 +++ b/db/schemas/sokwedb/indexes/drop/watches.m4 @@ -27,3 +27,4 @@ DROP INDEX IF EXISTS DROP INDEX IF EXISTS watches_focal; DROP INDEX IF EXISTS watches_commid; +DROP INDEX IF EXISTS watches_type; diff --git a/db/schemas/sokwedb/tables/create/watches.m4 b/db/schemas/sokwedb/tables/create/watches.m4 index 18dd64d..34670e5 100644 --- a/db/schemas/sokwedb/tables/create/watches.m4 +++ b/db/schemas/sokwedb/tables/create/watches.m4 @@ -48,6 +48,9 @@ CREATE TABLE watches ( ,date DATE NOT NULL CONSTRAINT "The WATCHES.Date must not be before sdb_min_follow_date" CHECK(date >= 'sdb_min_follow_date') + ,type TEXT NOT NULL + CONSTRAINT "Watches.Type must be one of: sdb_follow" + CHECK (type = 'sdb_follow') ,notes TEXT NOT NULL notonlyspaces_check(`Notes') ); diff --git a/doc/diagrams/watches.svg b/doc/diagrams/watches.svg index add1603..84978fe 100644 --- a/doc/diagrams/watches.svg +++ b/doc/diagrams/watches.svg @@ -688,9 +688,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="1.2761999" - inkscape:cx="586.11507" - inkscape:cy="381.99345" + inkscape:zoom="2.5523998" + inkscape:cx="376.9002" + inkscape:cy="507.95334" inkscape:document-units="mm" inkscape:current-layer="layer3" inkscape:document-rotation="0" @@ -1682,7 +1682,7 @@ id="tspan2100-9-1-3-1-0-4-2" x="101.51318" y="167.43768" - style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82223px;font-family:Sans;-inkscape-font-specification:'Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583px">NotesTypeNotes` .. |WATCHES.CommID| replace:: :ref:`CommID ` -.. |WATCHES.Notes| replace:: - :ref:`Notes ` .. |WATCHES.Date| replace:: :ref:`Date ` +.. |WATCHES.Type| replace:: + :ref:`Type ` +.. |WATCHES.Notes| replace:: + :ref:`Notes ` .. |FOLLOW_OBSERVERS| replace:: :ref:`FOLLOW_OBSERVERS ` .. |FOLLOW_OBSERVERS.FOID| replace:: diff --git a/doc/src/tables/watches.m4 b/doc/src/tables/watches.m4 index 4d72fb6..d32a3be 100644 --- a/doc/src/tables/watches.m4 +++ b/doc/src/tables/watches.m4 @@ -104,6 +104,22 @@ This date may not be before ``sdb_min_follow_date``. |notnull| +.. _WATCHES.Type: + +Type +```` + +.. |WATCHES.Type_summary| replace:: + The type of watch period. + +|WATCHES.Type_summary| + +One of the following values:: + ``sdb_follow`` + +|notnull| + + .. _WATCHES.Notes: Notes diff --git a/include/global_constants.m4 b/include/global_constants.m4 index 96a28f3..fa97bb7 100644 --- a/include/global_constants.m4 +++ b/include/global_constants.m4 @@ -185,5 +185,12 @@ dnl The Certainty value for when certain of the identity of an arriving dnl individual. define(`sdb_identity_certain', `1') +dnl +dnl WATCHES +dnl + +dnl The WATCHES.Type values +define(`sdb_follow', `F') + divert(`0')dnl Output with m4 again ]}])dnl End of ifdef over the whole file. -- 2.34.1