fix: db was not auto created
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user