Titel (vorangestellt): fachlich vorgegebene Liste
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 12m32s
CI / Migrationen auf leerer Datenbank (push) Successful in 11m11s
CI / Ausrollen (push) Successful in 7s

Neu: DI, Dipl.-Ing. (FH), DI (FH); Reihenfolge wie vorgegeben. Jeder
gespeicherte Titel steht auch in der neuen Liste. Migration
20261103100000 ersetzt chk_title_prefix_valid; lib/titles.ts fuehrt
dieselbe Liste fuer Formulare und Austauschdatei, tests/unit/titel.test.ts
gleicht beide ab.

Geprueft: lint, tsc, types:check, 1034 Tests, Waechter; alle Migrationen
auf leerer Datenbank (zweiter Lauf nichts anzuwenden), Rauchtest.
This commit is contained in:
2026-11-03 10:20:11 +01:00
parent 912ea38413
commit ebbb158bd3
3 changed files with 84 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
-- Vorangestellte Titel: fachlich vorgegebene Liste.
--
-- Jeder gespeicherte Titel steht auch in dieser Liste und bleibt damit
-- gültig. Dieselbe Liste und Reihenfolge
-- steht in lib/titles.ts (Auswahl in Formularen und Austauschdatei);
-- tests/unit/titel.test.ts gleicht beide ab.
alter table employees drop constraint if exists chk_title_prefix_valid;
alter table employees add constraint chk_title_prefix_valid check (
title_prefix <@ array[
'Dr.', 'DDr.', 'Mag.', 'MMag.', 'Dipl.-Ing.', 'DI', 'Ing.', 'Mag. (FH)',
'Dipl.-Ing. (FH)', 'DI (FH)', 'Dkfm.', 'Prof.', 'Priv.-Doz.'
]::text[]
);
do $pruefung$
declare
v_def text;
begin
select pg_get_constraintdef(oid) into v_def from pg_constraint where conname = 'chk_title_prefix_valid';
if v_def is null or position('''DI (FH)''' in v_def) = 0 or position('''Priv.-Doz.''' in v_def) = 0 then
raise exception 'chk_title_prefix_valid kennt die vorgegebenen Titel nicht.';
end if;
end
$pruefung$;