From b30b8e1ec0fc53977aba0c1c2101a0542ffa3a17 Mon Sep 17 00:00:00 2001 From: Yves Gugger Date: Wed, 17 Dec 2025 11:54:13 +0100 Subject: [PATCH] Fix: Use direct DB path for zone sync script (avoids import issues) --- backend/scripts/sync_all_zones.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/backend/scripts/sync_all_zones.py b/backend/scripts/sync_all_zones.py index 633626d..2a2de4d 100644 --- a/backend/scripts/sync_all_zones.py +++ b/backend/scripts/sync_all_zones.py @@ -86,17 +86,15 @@ class ZoneSyncResult: async def get_db_session(): - """Create async database session""" - from app.config import get_settings + """Create async database session for zone sync script""" + # Direct path to DB (script runs from backend/ directory) + db_path = Path("/home/user/pounce/backend/domainwatch.db") + if not db_path.exists(): + db_path = Path("domainwatch.db") - settings = get_settings() - db_url = settings.database_url + db_url = f"sqlite+aiosqlite:///{db_path}" - # Ensure we use async SQLite driver - if "sqlite://" in db_url and "aiosqlite" not in db_url: - db_url = db_url.replace("sqlite://", "sqlite+aiosqlite://") - - engine = create_async_engine(db_url) + engine = create_async_engine(db_url, echo=False) async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False) return async_session()