Kommentare beschreiben den heutigen Stand und warum er so ist, nicht mehr die Entwicklungsgeschichte: keine Datumsangaben zu Ereignissen, keine Vorfaelle an Testpersonen, keine Lieferantensicht, keine internen Namen oder Plattformen. In Migrationen nur Kommentare ausserhalb von Dollar-Quoting; Kommentare in Funktionskoerpern nur dort, wo ihr Text in keiner anderen Migration als Anker vorkommt. - Andreis Anpassungen aus windows-uebergabe nach master uebernommen. - LOLYO-Startpasswort kommt aus LOLYO_STARTPASSWORT statt aus dem Code; ohne Wert lehnt der Export mit Hinweis ab. - Beispiel- und erzeugte E-Mail-Adressen ohne Kundendomain. - Content-Security-Policy wird durchgesetzt; form-action fest mit login.microsoftonline.com, weil das Paket ohne Umgebungswerte gebaut wird. Geprueft im Browser: alle Seiten ohne Verstoss, Weiterleitung zu Microsoft geht durch. - migrate.mjs: einmalige Uebernahme der alten Buchfuehrung entfernt (seit 20260907100000 ohne Wirkung). - freischalten.ps1 vergibt und entzieht den HR-Zugang (-Entziehen) und protokolliert beides im Audit-Log. - docs/security-review.md -> docs/sicherheitskonzept.md: beschreibt den heutigen Stand ohne offene Punkte. README, entra-sso.md und deploy/windows/README.md ohne Widersprueche (Leserolle der IT, Freischaltung, Konto des Nachtlaufs), Abnahme-Checkliste statt "noch offen". Geprueft: lint, tsc, types:check, 823 Unit-Tests, Waechter (412 Dateien, keine Funde), alle 114 Migrationen auf leerem PostgreSQL 18 (zweiter Lauf leer), rauchtest.sql und vertragsangaben.sql bestanden.
34 lines
2.1 KiB
SQL
34 lines
2.1 KiB
SQL
-- Performance indexes.
|
|
--
|
|
-- Existing indexes already cover employees(team_id/division_id/manager_id/
|
|
-- status), employee_history(employee_id, event_date desc), positions(team_id/
|
|
-- status), audit_log(occurred_at desc), and the pending_org_changes table's
|
|
-- own indexes (see its migration). This adds the gaps: location-based
|
|
-- filtering, entry/exit date range queries (dashboard "upcoming" widget +
|
|
-- Eintritte/Austritte reports), personnel-number lookup (also enforces the
|
|
-- uniqueness a personnel number should have, which an identity column alone
|
|
-- does not guarantee), reorg/audit foreign-key lookups, and trigram search
|
|
-- support for the employee list's free-text search box.
|
|
|
|
create unique index if not exists idx_employees_personnel_number on employees (personnel_number);
|
|
create index if not exists idx_employees_location_id on employees (location_id);
|
|
create index if not exists idx_employees_entry_date on employees (entry_date);
|
|
create index if not exists idx_employees_exit_date on employees (exit_date) where exit_date is not null;
|
|
create index if not exists idx_employees_karenz_return_date on employees (karenz_return_date) where karenz_return_date is not null;
|
|
|
|
create index if not exists idx_audit_log_target_employee_id on audit_log (target_employee_id) where target_employee_id is not null;
|
|
create index if not exists idx_employee_history_reorg_scenario_id on employee_history (reorg_scenario_id) where reorg_scenario_id is not null;
|
|
create index if not exists idx_employee_history_event_type on employee_history (event_type);
|
|
create index if not exists idx_reorg_scenarios_applied on reorg_scenarios (applied, applied_at desc);
|
|
create index if not exists idx_positions_division_id on positions (division_id);
|
|
|
|
-- Free-text search over name/title (Mitarbeiter:innen list search box) —
|
|
-- trigram index so ILIKE '%term%' queries can use an index instead of a
|
|
-- sequential scan.
|
|
create extension if not exists pg_trgm;
|
|
|
|
create index if not exists idx_employees_name_trgm
|
|
on employees using gin ((first_name || ' ' || last_name) gin_trgm_ops);
|
|
create index if not exists idx_employees_job_title_trgm
|
|
on employees using gin (job_title gin_trgm_ops);
|