cwa import

This commit is contained in:
2026-05-13 18:29:25 +02:00
parent c0e1cb0688
commit 27fa22eee1
+13
View File
@@ -65,6 +65,19 @@ def init_db() -> None:
cached_at TEXT NOT NULL
);
""")
_migrate(conn)
def _migrate(conn: sqlite3.Connection) -> None:
existing = {row[1] for row in conn.execute("PRAGMA table_info(sync_runs)")}
if "books_imported" not in existing:
conn.execute("ALTER TABLE sync_runs ADD COLUMN books_imported INTEGER DEFAULT 0")
for old_col in ("books_uploaded", "books_skipped"):
if old_col in existing:
try:
conn.execute(f"ALTER TABLE sync_runs DROP COLUMN {old_col}")
except Exception:
pass
# --- Settings ---