From acedc52d78d2638bef9738474cba075d3520bcb7 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Thu, 2 Oct 2025 23:44:38 +0000 Subject: [PATCH] Make SPECIES.Species unique when ignoring case --- db/schemas/codes/indexes/Makefile | 3 ++- db/schemas/codes/indexes/create/species.m4 | 27 ++++++++++++++++++++++ db/schemas/codes/indexes/drop/species.m4 | 24 +++++++++++++++++++ doc/src/code_tables.m4 | 2 +- 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 db/schemas/codes/indexes/create/species.m4 create mode 100644 db/schemas/codes/indexes/drop/species.m4 diff --git a/db/schemas/codes/indexes/Makefile b/db/schemas/codes/indexes/Makefile index 9a5f025..17dad01 100644 --- a/db/schemas/codes/indexes/Makefile +++ b/db/schemas/codes/indexes/Makefile @@ -24,7 +24,8 @@ ORDER := comm_ids \ cycle_states \ obs_periods \ people \ - role_codes + role_codes \ + species ## ## CAUTION: This Makefile is not designed to be run directly. It is normally diff --git a/db/schemas/codes/indexes/create/species.m4 b/db/schemas/codes/indexes/create/species.m4 new file mode 100644 index 0000000..57a0ec5 --- /dev/null +++ b/db/schemas/codes/indexes/create/species.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 species_species_uniquenocase + ON species + (sdb_case_equivalence(species)); + diff --git a/db/schemas/codes/indexes/drop/species.m4 b/db/schemas/codes/indexes/drop/species.m4 new file mode 100644 index 0000000..229ac8f --- /dev/null +++ b/db/schemas/codes/indexes/drop/species.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 species_species_uniquenocase; diff --git a/doc/src/code_tables.m4 b/doc/src/code_tables.m4 index 67a90da..0da0249 100644 --- a/doc/src/code_tables.m4 +++ b/doc/src/code_tables.m4 @@ -574,7 +574,7 @@ Species .. |SPECIES.Species_summary| replace:: A textual code identifying a particular specie. -|SPECIES.Species_summary| |emptytext| |keycol| |uppercase| +|SPECIES.Species_summary| |emptytext| |caseuniquekeycol| |uppercase| .. _SPECIES.Description: -- 2.34.1