Fix: Check table existence before migration

This commit is contained in:
2026-01-06 20:59:56 +09:00
parent 77e0c07553
commit 7a61f17138
2 changed files with 7 additions and 1 deletions

View File

@@ -69,6 +69,12 @@ class ModelDownloadItem(ModelBase):
conn = sqlite3.connect(db_file)
cursor = conn.cursor()
# 테이블 존재 여부 확인
cursor.execute(f"SELECT count(*) FROM sqlite_master WHERE type='table' AND name='{cls.__tablename__}'")
if cursor.fetchone()[0] == 0:
conn.close()
return
# meta 컬럼 확인
cursor.execute(f"PRAGMA table_info({cls.__tablename__})")
columns = [info[1] for info in cursor.fetchall()]