const { PrismaClient } = require('@prisma/client'); const prisma = new PrismaClient(); async function checkBookFields() { try { const book = await prisma.book.findUnique({ where: { id: 1 } }); console.log('📖 Book ID=1 字段检查:'); console.log(` title: ${book.title}`); console.log(` bookScale: ${book.bookScale}`); console.log(` description: ${book.description}`); console.log(` targetAudience: ${book.targetAudience}`); console.log(` style: ${book.style}`); console.log(` status: ${book.status}`); console.log(''); if (!book.bookScale) { console.log('⚠️ bookScale为空,需要设置默认值'); await prisma.book.update({ where: { id: 1 }, data: { bookScale: '130000' } }); console.log('✅ 已设置 bookScale = 130000'); } } catch (error) { console.error('错误:', error); } finally { await prisma.$disconnect(); } } checkBookFields();