fix(deploy): align intake sku schema before release
This commit is contained in:
parent
929b0eacd3
commit
5b0f98264c
@ -0,0 +1,8 @@
|
||||
-- Keep the structured SKU table aligned with the source metadata fields in
|
||||
-- IntakeNonIntegratedSkuItem. Historical SKU payloads do not carry values for
|
||||
-- these fields, so no data backfill is required.
|
||||
ALTER TABLE "IntakeNonIntegratedSkuItem"
|
||||
ADD COLUMN IF NOT EXISTS "sourceWeight" DECIMAL(18, 3),
|
||||
ADD COLUMN IF NOT EXISTS "sourceBrand" TEXT NOT NULL DEFAULT '',
|
||||
ADD COLUMN IF NOT EXISTS "sourceCreatedAt" TIMESTAMP(3),
|
||||
ADD COLUMN IF NOT EXISTS "sourceUpdatedAt" TIMESTAMP(3);
|
||||
33
furniture-3d-system/scripts/verify-prisma-runtime-schema.js
Normal file
33
furniture-3d-system/scripts/verify-prisma-runtime-schema.js
Normal file
@ -0,0 +1,33 @@
|
||||
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()
|
||||
})
|
||||
@ -573,6 +573,10 @@ export ONNXRUNTIME_NODE_INSTALL_CUDA=skip
|
||||
npm ci --no-audit --no-fund
|
||||
npx prisma generate
|
||||
npx prisma migrate deploy
|
||||
set -a
|
||||
source "$SHARED/.env"
|
||||
set +a
|
||||
node scripts/verify-prisma-runtime-schema.js
|
||||
npm run build
|
||||
ensure_shared_non_integrated_assets "$APP_DIR"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user