From aa7ae184322cbea573188274132b09e80f8c2bfb Mon Sep 17 00:00:00 2001 From: jacquesbach Date: Fri, 13 Mar 2026 17:33:42 +0100 Subject: [PATCH 1/2] Force rebuild daily stats --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 71aa77e..85fb2d4 100644 --- a/app.py +++ b/app.py @@ -25,7 +25,7 @@ init_db() # 🔥 EINMAL ausführen, danach wieder auskommentieren! - # force_rebuild_daily_stats() + force_rebuild_daily_stats() self_heal_daily_stats() From 529efc1e325616c263697da6ab6bc1e0f927312c Mon Sep 17 00:00:00 2001 From: jacquesbach Date: Fri, 13 Mar 2026 17:35:42 +0100 Subject: [PATCH 2/2] Undo force_rebuild daily_stats table --- app.py | 2 +- database.py | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/app.py b/app.py index 85fb2d4..71aa77e 100644 --- a/app.py +++ b/app.py @@ -25,7 +25,7 @@ init_db() # 🔥 EINMAL ausführen, danach wieder auskommentieren! - force_rebuild_daily_stats() + # force_rebuild_daily_stats() self_heal_daily_stats() diff --git a/database.py b/database.py index ec5e579..61cbdda 100644 --- a/database.py +++ b/database.py @@ -52,24 +52,6 @@ def init_db(): kwh_dc_total REAL ) ''') - - # 2. AUTOMATISCHES UPGRADE für neue Spalten - c.execute("PRAGMA table_info(daily_stats)") - existing_columns = [col[1] for col in c.fetchall()] - - if "daylight_duration" not in existing_columns: - print("Migriere Datenbank: Spalte daylight_duration wird hinzugefügt...") - c.execute("ALTER TABLE daily_stats ADD COLUMN daylight_duration REAL") - - if "sunshine_duration" not in existing_columns: - print("Migriere Datenbank: Spalte sunshine_duration wird hinzugefügt...") - c.execute("ALTER TABLE daily_stats ADD COLUMN sunshine_duration REAL") - - # 3. Restliche Spalten (max_w_panel1, etc.) sicherstellen - # Falls du die auch noch nicht hast, kannst du das Muster einfach fortsetzen: - for col in ["max_w_panel1", "max_w_panel2", "kwh_panel1", "kwh_panel2", "kwh_dc_total"]: - if col not in existing_columns: - c.execute(f"ALTER TABLE daily_stats ADD COLUMN {col} REAL") # 3. Globale Gesamt-Statistiken c.execute('''