fix(storage): 严格解析本地策略并原子执行数据库迁移

This commit is contained in:
2026-09-04 19:57:26 +08:00
parent 78dd774bce
commit cec89494f9
6 changed files with 210 additions and 10 deletions
+6 -2
View File
@@ -32,8 +32,12 @@ def connect() -> sqlite3.Connection:
# 关闭 Python sqlite3 的隐式事务,提交时机由 transaction() 或显式 commit 控制。
conn.isolation_level = None
conn.execute("PRAGMA foreign_keys = ON")
_load_extension(conn)
migrate(conn)
try:
_load_extension(conn)
migrate(conn)
except BaseException:
conn.close()
raise
return conn