From 36c7952d3ef0ac698e9725a5eab1c5f5e99b3720 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Thu, 2 Oct 2025 23:36:58 +0000 Subject: [PATCH] Make ROLE_CODES.Role unique when ignoring case --- db/schemas/codes/indexes/Makefile | 3 ++- db/schemas/codes/indexes/create/role_codes.m4 | 27 +++++++++++++++++++ db/schemas/codes/indexes/drop/role_codes.m4 | 24 +++++++++++++++++ doc/src/code_tables.m4 | 2 +- 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 db/schemas/codes/indexes/create/role_codes.m4 create mode 100644 db/schemas/codes/indexes/drop/role_codes.m4 diff --git a/db/schemas/codes/indexes/Makefile b/db/schemas/codes/indexes/Makefile index 4de2d4d..9a5f025 100644 --- a/db/schemas/codes/indexes/Makefile +++ b/db/schemas/codes/indexes/Makefile @@ -23,7 +23,8 @@ ORDER := comm_ids \ comm_membs_sources \ cycle_states \ obs_periods \ - people + people \ + role_codes ## ## CAUTION: This Makefile is not designed to be run directly. It is normally diff --git a/db/schemas/codes/indexes/create/role_codes.m4 b/db/schemas/codes/indexes/create/role_codes.m4 new file mode 100644 index 0000000..0f2621b --- /dev/null +++ b/db/schemas/codes/indexes/create/role_codes.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 role_codes_role_uniquenocase + ON role_codes + (sdb_case_equivalence(role)); + diff --git a/db/schemas/codes/indexes/drop/role_codes.m4 b/db/schemas/codes/indexes/drop/role_codes.m4 new file mode 100644 index 0000000..49f9289 --- /dev/null +++ b/db/schemas/codes/indexes/drop/role_codes.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 role_codes_role_uniquenocase; diff --git a/doc/src/code_tables.m4 b/doc/src/code_tables.m4 index 6b27447..67a90da 100644 --- a/doc/src/code_tables.m4 +++ b/doc/src/code_tables.m4 @@ -530,7 +530,7 @@ observations of non-chimpanzees. To have more specific roles risks encoding the same information in multiple places, which is bad practice. -|keycol| |uppercase| +|caseuniquekeycol| |uppercase| .. _ROLE_CODES.Description: -- 2.34.1