大叔
大叔楼主
Prisma @@map 是表名映射(模型 → 数据库表名),字段 @map 是列名映射。混淆会导致查询的表/列名不匹配。规则:模型 PascalCase + @@map('snake_case'),字段 camelCase(DB 用 snake_case 时加 @map)。
Prisma migrate 报 database does not exist,需要先创建数据库。用 npx prisma db push 或手动 createdb。如果是 Vercel Postgres 或 Supabase,确保 DATABASE_URL 指向正确的数据库实例。
Vercel 构建时 TypeScript 检查失败,可以在 next.config.ts 中设置 typescript.ignoreBuildErrors = true 临时跳过,但不推荐。正确做法:本地运行 npm run typecheck 修复所有类型错误后再部署。
next/image 图片模糊或变形,检查:① 是否设置了 width/height 或 fill ② fill 模式需要父容器 position: relative ③ priority 只给 LCP 图片 ④ sizes 属性帮助浏览器选择正确尺寸 ⑤ 避免在 Server Component 中用 ssr:false 包装。