From de644ed1b782adee8cbee08bf70bb6d08469b485 Mon Sep 17 00:00:00 2001 From: Ou Date: Wed, 30 Oct 2024 16:12:05 +0800 Subject: [PATCH] fix: wrong bindingName --- nitro.config.ts | 2 +- server/database/cache.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/nitro.config.ts b/nitro.config.ts index ed103e3..6281dfb 100644 --- a/nitro.config.ts +++ b/nitro.config.ts @@ -37,7 +37,7 @@ if (process.env.VERCEL) { default: { connector: "cloudflare-d1", options: { - bindingName: "NEWSNOW_DEV", + bindingName: "NEWSNOW_DB", }, }, } diff --git a/server/database/cache.ts b/server/database/cache.ts index 8267d8f..0fc524a 100644 --- a/server/database/cache.ts +++ b/server/database/cache.ts @@ -49,7 +49,6 @@ export async function getCacheTable() { try { // 如果没有数据库,这里不会报错,只会在第一次访问的时候报错 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 const cacheTable = new Cache(db) if (process.env.INIT_TABLE !== "false") await cacheTable.init()