性能: 共享httpx连接池/设置缓存/复合索引自动补建/GZip/分页 ; 商业化v1: APIKey(sha256+scope+限流)/用量账本/版本化端点
This commit is contained in:
@@ -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)})'))
|
||||
|
||||
Reference in New Issue
Block a user