From f41d97bf1a9baf91ac9b3cb78eea4ae41eaf97a7 Mon Sep 17 00:00:00 2001 From: Caihaohan Date: Sat, 10 Jan 2026 12:28:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Vercel=20=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E9=85=8D=E7=BD=AE=E5=B9=B6=E6=B7=BB=E5=8A=A0=20Neon?= =?UTF-8?q?=20=E6=95=B0=E6=8D=AE=E5=BA=93=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 vercel.json 中不存在的 Secret 引用 (@database_url) - 在 CLAUDE.md 中添加 Neon 数据库配置说明 - 环境变量应直接在 Vercel Dashboard 中设置 Co-Authored-By: Claude --- CLAUDE.md | 8 ++++++++ vercel.json | 5 +---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index c741c9b..318b308 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -52,6 +52,7 @@ src/app/ ``` ### Database (Prisma + PostgreSQL) +- **Provider**: Neon (serverless PostgreSQL) - **Schema**: `prisma/schema.prisma` defines models: `Project`, `Tag`, `ExternalLink`, `ProjectTag` - **Enums**: `ProjectStatus` (ACTIVE/ARCHIVED), `LinkType` (WEBSITE/GITHUB/HUGGINGFACE/PAPER) - **Client singleton**: `src/lib/prisma.ts` exports Prisma client instance @@ -64,6 +65,13 @@ src/app/ - `ExternalLink`: `@@unique([projectId, url])` (each project can't have duplicate URLs) - **Indexes**: `idx_project_status_createdAt`, `idx_project_slug`, `idx_tag_slug`, `idx_link_projectId`, `idx_link_type`, `idx_link_type_url` (composite for efficient URL-based deduplication) +#### Neon Database Setup +- **Dashboard**: https://console.neon.tech +- **Connection String Format**: `postgres://[user]:[password]@[host]/[database]?sslmode=require` +- **Vercel Integration**: Set `DATABASE_URL` environment variable in Vercel Dashboard (do NOT use `vercel.json` env references) +- **Free Tier**: 0.5GB storage, 300 hours compute/month +- **Run Migrations**: After deployment, run `pnpm prisma db push` or use Neon's SQL Editor to create tables + ### Webhook Deduplication Strategy The webhook at `src/app/api/webhook/projects/route.ts` implements a **multi-level deduplication** strategy to prevent duplicate projects: 1. **GitHub URL exact match** (highest priority) - via `ExternalLink` table using `idx_link_type_url` index diff --git a/vercel.json b/vercel.json index 90c83b5..d591be0 100644 --- a/vercel.json +++ b/vercel.json @@ -2,8 +2,5 @@ "buildCommand": "pnpm prisma generate && pnpm build", "installCommand": "pnpm install", "framework": "nextjs", - "regions": ["sin1"], - "env": { - "DATABASE_URL": "@database_url" - } + "regions": ["sin1"] }