From 1ecbec8fe67abb9aeaa6bd0910d8901e60a169d3 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Thu, 2 Oct 2025 23:26:58 +0000 Subject: [PATCH] Make CYCLE_STATES.Code unique when ignoring case --- db/schemas/codes/indexes/Makefile | 4 ++- .../codes/indexes/create/cycle_states.m4 | 27 +++++++++++++++++++ db/schemas/codes/indexes/drop/cycle_states.m4 | 24 +++++++++++++++++ .../codes/tables/create/cycle_states.m4 | 3 +-- doc/src/code_tables.m4 | 2 +- 5 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 db/schemas/codes/indexes/create/cycle_states.m4 create mode 100644 db/schemas/codes/indexes/drop/cycle_states.m4 diff --git a/db/schemas/codes/indexes/Makefile b/db/schemas/codes/indexes/Makefile index 959a0ed..be90ab8 100644 --- a/db/schemas/codes/indexes/Makefile +++ b/db/schemas/codes/indexes/Makefile @@ -19,7 +19,9 @@ # This determines the order in which the indexes are put into the database. # This is not really important but is needed for other types of db objects. -ORDER := comm_ids +ORDER := comm_ids \ + comm_membs_sources \ + cycle_states ## ## CAUTION: This Makefile is not designed to be run directly. It is normally diff --git a/db/schemas/codes/indexes/create/cycle_states.m4 b/db/schemas/codes/indexes/create/cycle_states.m4 new file mode 100644 index 0000000..8908283 --- /dev/null +++ b/db/schemas/codes/indexes/create/cycle_states.m4 @@ -0,0 +1,27 @@ +dnl Copyright (C) 2025 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 cycle_states_code_uniquenocase + ON cycle_states + (sdb_case_equivalence(code)); + diff --git a/db/schemas/codes/indexes/drop/cycle_states.m4 b/db/schemas/codes/indexes/drop/cycle_states.m4 new file mode 100644 index 0000000..899847a --- /dev/null +++ b/db/schemas/codes/indexes/drop/cycle_states.m4 @@ -0,0 +1,24 @@ +dnl Copyright (C) 2025 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(`macros.m4')dnl + +DROP INDEX IF EXISTS cycle_states_code_uniquenocase; diff --git a/db/schemas/codes/tables/create/cycle_states.m4 b/db/schemas/codes/tables/create/cycle_states.m4 index 192fd8a..b343094 100644 --- a/db/schemas/codes/tables/create/cycle_states.m4 +++ b/db/schemas/codes/tables/create/cycle_states.m4 @@ -24,6 +24,5 @@ include(`grants.m4')dnl dnl support_table(`CYCLE_STATES', `Code', `TEXT', ` - emptytext_check(`Code') - uppercase_check(`Code')' + emptytext_check(`Code')' ) diff --git a/doc/src/code_tables.m4 b/doc/src/code_tables.m4 index 6ab59fc..c2b48be 100644 --- a/doc/src/code_tables.m4 +++ b/doc/src/code_tables.m4 @@ -349,7 +349,7 @@ Code .. |CYCLE_STATES.Code_summary| replace:: The code that designates an estrous swelling state. -|CYCLE_STATES.Code_summary| |keycol| +|CYCLE_STATES.Code_summary| |caseuniquekeycol| .. _CYCLE_STATES.Description: -- 2.34.1