fix: db was not auto created
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ import { ourongxing, react } from "@ourongxing/eslint-config"
|
||||
export default ourongxing({
|
||||
type: "app",
|
||||
// 貌似不能 ./ 开头,
|
||||
ignores: ["src/routeTree.gen.ts", "imports.app.d.ts", "public/", ".vscode"],
|
||||
ignores: ["src/routeTree.gen.ts", "imports.app.d.ts", "public/", ".vscode", "**/*.json"],
|
||||
}).append(react({
|
||||
files: ["src/**"],
|
||||
}))
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ const nitroOption: Parameters<typeof viteNitro>[0] = {
|
||||
sourceMap: false,
|
||||
database: {
|
||||
default: {
|
||||
connector: "sqlite",
|
||||
connector: "better-sqlite3",
|
||||
},
|
||||
},
|
||||
imports: {
|
||||
|
||||
+15
-5
@@ -104,20 +104,30 @@
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"dayjs": "patches/dayjs.patch"
|
||||
}
|
||||
},
|
||||
"onlyBuiltDependencies": [
|
||||
"@napi-rs/pinyin",
|
||||
"@parcel/watcher",
|
||||
"@swc/core",
|
||||
"better-sqlite3",
|
||||
"esbuild",
|
||||
"sharp",
|
||||
"simple-git-hooks",
|
||||
"workerd"
|
||||
]
|
||||
},
|
||||
"resolutions": {
|
||||
"cross-spawn": ">=7.0.6",
|
||||
"dayjs": "1.11.13",
|
||||
"picomatch": "^4.0.2"
|
||||
"picomatch": "^4.0.2",
|
||||
"react": "^19",
|
||||
"db0": "^0.3.1",
|
||||
"vite": "^6"
|
||||
},
|
||||
"simple-git-hooks": {
|
||||
"pre-commit": "npx lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*": "eslint --fix"
|
||||
},
|
||||
"volta": {
|
||||
"node": "22.12.0"
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+1322
-1580
File diff suppressed because it is too large
Load Diff
@@ -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