Fix: Use direct DB path for zone sync script (avoids import issues)
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
This commit is contained in:
@ -86,17 +86,15 @@ class ZoneSyncResult:
|
|||||||
|
|
||||||
|
|
||||||
async def get_db_session():
|
async def get_db_session():
|
||||||
"""Create async database session"""
|
"""Create async database session for zone sync script"""
|
||||||
from app.config import get_settings
|
# 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 = f"sqlite+aiosqlite:///{db_path}"
|
||||||
db_url = settings.database_url
|
|
||||||
|
|
||||||
# Ensure we use async SQLite driver
|
engine = create_async_engine(db_url, echo=False)
|
||||||
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)
|
|
||||||
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
||||||
return async_session()
|
return async_session()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user