From 9863965976d44fd028f8710b245445ca5cf812ec Mon Sep 17 00:00:00 2001 From: sanj <67624670+iodrift@users.noreply.github.com> Date: Mon, 12 Aug 2024 18:02:22 -0700 Subject: [PATCH] Auto-update: Mon Aug 12 18:02:22 PDT 2024 --- sijapi/database.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sijapi/database.py b/sijapi/database.py index 2eeebbf..ac1f3c2 100644 --- a/sijapi/database.py +++ b/sijapi/database.py @@ -273,6 +273,15 @@ class Database: except Exception as e: l.error(f"Error calling /db/sync on {url}: {str(e)}") + async def ensure_query_tracking_table(self): + for ts_id, engine in self.engines.items(): + try: + async with engine.begin() as conn: + await conn.run_sync(Base.metadata.create_all) + l.info(f"Ensured query_tracking table exists for {ts_id}") + except Exception as e: + l.error(f"Failed to create query_tracking table for {ts_id}: {str(e)}") + async def close(self): for engine in self.engines.values(): await engine.dispose()