fix: wrong bindingName

This commit is contained in:
Ou 2024-10-30 16:12:05 +08:00
parent 13a32db931
commit de644ed1b7
2 changed files with 1 additions and 2 deletions

View File

@ -37,7 +37,7 @@ if (process.env.VERCEL) {
default: { default: {
connector: "cloudflare-d1", connector: "cloudflare-d1",
options: { options: {
bindingName: "NEWSNOW_DEV", bindingName: "NEWSNOW_DB",
}, },
}, },
} }

View File

@ -49,7 +49,6 @@ export async function getCacheTable() {
try { try {
// 如果没有数据库,这里不会报错,只会在第一次访问的时候报错 // 如果没有数据库,这里不会报错,只会在第一次访问的时候报错
const db = useDatabase() const db = useDatabase()
if (process.env.CF_PAGES_BRANCH && process.env.CF_PAGES_BRANCH !== "main") return
if (process.env.NODE_ENV && process.env.NODE_ENV !== "production") return if (process.env.NODE_ENV && process.env.NODE_ENV !== "production") return
const cacheTable = new Cache(db) const cacheTable = new Cache(db)
if (process.env.INIT_TABLE !== "false") await cacheTable.init() if (process.env.INIT_TABLE !== "false") await cacheTable.init()