furniture-3d-system-Wu/furniture-3d-system/scripts/verify-prisma-runtime-schema.js

34 lines
1001 B
JavaScript

const { PrismaClient } = require('@prisma/client')
const { PrismaPg } = require('@prisma/adapter-pg')
const { Pool } = require('pg')
const databaseUrl = process.env.DATABASE_URL
if (!databaseUrl) {
throw new Error('DATABASE_URL is required for the Prisma runtime schema check.')
}
const pool = new Pool({ connectionString: databaseUrl })
const prisma = new PrismaClient({ adapter: new PrismaPg(pool) })
async function main() {
// Select the complete model so missing scalar columns fail before release.
await prisma.intakeNonIntegratedSkuItem.findFirst({
orderBy: { createdAt: 'desc' },
})
console.log('Prisma runtime schema check passed for IntakeNonIntegratedSkuItem.')
}
main()
.catch((error) => {
const code = typeof error?.code === 'string' ? error.code : 'unknown'
console.error(`Prisma runtime schema check failed (${code}).`)
console.error(error)
process.exitCode = 1
})
.finally(async () => {
await prisma.$disconnect()
await pool.end()
})