From edeb3ccece9e7ff70dd92bbbfb7ae3a2830480e9 Mon Sep 17 00:00:00 2001 From: owain Date: Sun, 7 Jun 2026 01:11:55 +0100 Subject: [PATCH] Fix: commit missing init_db migration for sync_lookback_days column This ALTER TABLE was written locally but never staged, so the production image ran without it and the column was never added to the DB. Co-Authored-By: Claude Sonnet 4.6 --- backend/app/main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/app/main.py b/backend/app/main.py index c2f3933..a487efc 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -40,6 +40,16 @@ async def init_db(): except Exception as e: print(f"TimescaleDB hypertable skipped: {e}") + # Add columns that were introduced after initial table creation (non-fatal) + try: + async with engine.begin() as conn: + await conn.execute(text( + "ALTER TABLE garmin_connect_configs " + "ADD COLUMN IF NOT EXISTS sync_lookback_days INTEGER DEFAULT 30" + )) + except Exception as e: + print(f"Column migration skipped: {e}") + # Seed admin user (only if password is configured) if not settings.admin_password: print("ADMIN_PASSWORD not set - skipping admin user seed")