fix: db was not auto created

This commit is contained in:
Ou
2025-03-04 13:31:57 +08:00
parent 75c0f22fd5
commit 099a840d4c
5 changed files with 1342 additions and 1590 deletions
+3 -3
View File
@@ -73,13 +73,13 @@ export class Cache {
export async function getCacheTable() {
try {
// 如果没有数据库,这里不会报错,只会在第一次访问的时候报错
const db = useDatabase()
logger.info("db: ", db.getInstance())
if (process.env.ENABLE_CACHE === "false") return
const cacheTable = new Cache(db)
if (process.env.INIT_TABLE !== "false") await cacheTable.init()
return cacheTable
} catch {
// logger.error("failed to init database ", e)
} catch (e) {
logger.error("failed to init database ", e)
}
}