furniture-3d-system-Wu/scripts/check-prisma-client-sync.js
WuYongJie f14df4a24b feat(新平台): 提交开放产品主链与装配语义能力
- 新增资产中心、自动组合、草稿组、入库与轻仓库一期骨架

- 接入 Panel 装配语义保存、预览与步骤生成测试

- 更新包装方案同事交接文档与非程序员操作手册
2026-03-31 09:37:13 +08:00

38 lines
1.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const path = require('path')
function fail(message) {
console.error(`[prisma-check] ${message}`)
process.exit(1)
}
let prismaModulePath
let Prisma
try {
prismaModulePath = require.resolve('@prisma/client')
;({ Prisma } = require('@prisma/client'))
} catch (error) {
fail(`无法加载 @prisma/client:${error instanceof Error ? error.message : String(error)}`)
}
const panelScalarFields = Prisma?.PanelScalarFieldEnum
if (!panelScalarFields || typeof panelScalarFields !== 'object') {
fail('未找到 PanelScalarFieldEnum,请先执行 npm run prisma:generate')
}
if (!Object.prototype.hasOwnProperty.call(panelScalarFields, 'assemblySemantic')) {
fail(
[
'检测到 Prisma Client 与 schema 不一致:缺少 Panel.assemblySemantic 字段。',
'请先执行:npm run prisma:generate',
`当前加载路径:${prismaModulePath}`,
].join(' '),
)
}
console.log(
`[prisma-check] ok: Panel.assemblySemantic 已存在(@prisma/client: ${path.normalize(
prismaModulePath,
)})`,
)