Feature: Abo-Kündigung + Ablaufdatum + Dog-Auswahl nach Downgrade (SW by-v945)

This commit is contained in:
rene 2026-05-14 13:56:55 +02:00
parent 44b3fba191
commit 3b666c545f
10 changed files with 341 additions and 11 deletions

View file

@ -2145,6 +2145,25 @@ def _migrate(conn_factory):
except Exception:
pass # Spalte existiert bereits
# ---- Feature: is_active für Hunde (nach Abo-Downgrade) ----
try:
conn.execute("ALTER TABLE dogs ADD COLUMN is_active INTEGER NOT NULL DEFAULT 1")
logger.info("Migration: dogs.is_active hinzugefügt.")
except Exception:
pass
# ---- Feature: Subscription-Laufzeit & Kündigung ----
for col, default in [
("subscription_expires_at", "NULL"),
("subscription_cancelled_at","NULL"),
("needs_dog_selection", "0"),
]:
try:
conn.execute(f"ALTER TABLE users ADD COLUMN {col} TEXT DEFAULT {default}")
logger.info(f"Migration: {col} hinzugefügt.")
except Exception:
pass
# exercise_progress + training_plan_progress: dog_id ergänzen
existing_ep = [r[1] for r in conn.execute("PRAGMA table_info(exercise_progress)").fetchall()]
if 'dog_id' not in existing_ep: