性能: 共享httpx连接池/设置缓存/复合索引自动补建/GZip/分页 ; 商业化v1: APIKey(sha256+scope+限流)/用量账本/版本化端点

This commit is contained in:
zhiqui
2026-11-15 01:37:59 +08:00
parent 18ae7e1f9d
commit 495083f9b4
7 changed files with 283 additions and 32 deletions
+6
View File
@@ -49,3 +49,9 @@ async def init_db():
await conn.execute(text(
f"UPDATE {table.name} SET {col.name}=0 "
f"WHERE {col.name}=''"))
# 旧表补建索引(create_all 只对新建表生效)
for table in Base.metadata.tables.values():
for idx in table.indexes:
await conn.execute(text(
f'CREATE INDEX IF NOT EXISTS "{idx.name}" ON "{table.name}" '
f'({", ".join(f"\'{c.name}\'" for c in idx.columns)})'))