获取同步数据库连接(用于初始化)
(self)
| 42 | await conn.close() |
| 43 | |
| 44 | def get_sync_connection(self): |
| 45 | """获取同步数据库连接(用于初始化)""" |
| 46 | conn = sqlite3.connect(self.db_path) |
| 47 | # 启用外键约束 |
| 48 | conn.execute("PRAGMA foreign_keys = ON") |
| 49 | return conn |
| 50 | |
| 51 | async def init_database(self): |
| 52 | """初始化数据库表结构""" |