Feat: Tierärzte-Verwaltung (Sprint 4)

Neue Praxen-Tab in Gesundheit: Tierarzt-Stammdaten (Name, Adresse,
Telefon, Notfall-Nr, E-Mail, Website, Notizen), Anruf- und
Notfall-Schnellzugriff via tel:-Links, Soft-Delete (aktiv=0) für
Praxiswechsel ohne Datenverlust. Tierarzt-Dropdown beim Eintragen
von Tierarzt-Besuchen. SW-Cache → by-v7.
This commit is contained in:
rene 2026-04-13 20:06:59 +02:00
parent c06d9e24a7
commit fc0f48c6d0
7 changed files with 371 additions and 42 deletions

View file

@ -249,6 +249,23 @@ def init_db():
created_at TEXT NOT NULL DEFAULT (datetime('now'))
);
-- TIERÄRZTE (user-level, nie löschen Historien-Erhalt bei Umzug)
CREATE TABLE IF NOT EXISTS tieraerzte (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
name TEXT NOT NULL,
adresse TEXT,
telefon TEXT,
notfall_telefon TEXT,
email TEXT,
website TEXT,
notizen TEXT,
ist_notfallpraxis INTEGER NOT NULL DEFAULT 0,
aktiv INTEGER NOT NULL DEFAULT 1,
created_at TEXT NOT NULL DEFAULT (datetime('now'))
);
CREATE INDEX IF NOT EXISTS idx_tieraerzte_user ON tieraerzte(user_id, aktiv);
""")
# Migrations: neue Spalten zu bestehenden Tabellen hinzufügen (idempotent)
@ -277,6 +294,7 @@ def _migrate(conn_factory):
("health", "reaktion", "TEXT"),
("health", "datei_url", "TEXT"),
("health", "datei_typ", "TEXT"),
("health", "tierarzt_id", "INTEGER"),
]
with conn_factory() as conn:
for table, column, col_type in migrations: