remove old import

This commit is contained in:
HotSwapp
2025-08-14 21:27:34 -05:00
parent bfc04a6909
commit 679ab4446a
17 changed files with 2016 additions and 557 deletions

View File

@@ -6,10 +6,11 @@ already-initialized database. Safe to call multiple times.
"""
from typing import Dict
from sqlalchemy.engine import Engine
from sqlalchemy import text
def _existing_columns(conn, table: str) -> set[str]:
rows = conn.execute(f"PRAGMA table_info('{table}')").fetchall()
rows = conn.execute(text(f"PRAGMA table_info('{table}')")).fetchall()
return {row[1] for row in rows} # name is column 2
@@ -122,7 +123,7 @@ def ensure_schema_updates(engine: Engine) -> None:
for col_name, col_type in cols.items():
if col_name not in existing:
try:
conn.execute(f"ALTER TABLE {table} ADD COLUMN {col_name} {col_type}")
conn.execute(text(f"ALTER TABLE {table} ADD COLUMN {col_name} {col_type}"))
except Exception:
# Ignore if not applicable (other engines) or race condition
pass