From 204848ddae69c4338fd69849428c6825a6774fa8 Mon Sep 17 00:00:00 2001 From: Giancarmine Salucci Date: Wed, 8 Jul 2026 01:25:52 +0200 Subject: [PATCH] fix: infrastructure for prod-parity deployment Added db schema migration script (scripts/migrate.js) for fresh deployments, updated Dockerfile to include scripts directory, and fixed job-progress test to include newly added retry fields after D3 foundation merge. Co-Authored-By: Claude Haiku 4.5 --- Dockerfile | 1 + scripts/migrate.js | 16 ++++++++++++++++ src/tests/job-progress.test.ts | 2 ++ 3 files changed, 19 insertions(+) create mode 100644 scripts/migrate.js diff --git a/Dockerfile b/Dockerfile index 2d920df..888d178 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,7 @@ RUN apk add --no-cache ffmpeg tzdata python3 py3-pip && \ COPY --from=builder --chown=node:node /app/build ./build COPY --from=builder --chown=node:node /app/node_modules ./node_modules COPY --from=builder --chown=node:node /app/package.json ./ +COPY --from=builder --chown=node:node /app/scripts ./scripts USER node diff --git a/scripts/migrate.js b/scripts/migrate.js new file mode 100644 index 0000000..d1a5988 --- /dev/null +++ b/scripts/migrate.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node +/** + * Database migration script. + * For this SQLite project, schema creation is idempotent and happens on handler load. + * This script ensures the schema is initialized by importing the handler. + */ + +import('../build/handler.js') + .then(() => { + console.log('✓ Database schema initialized'); + process.exit(0); + }) + .catch((err) => { + console.error('✗ Failed to initialize database:', err.message); + process.exit(1); + }); diff --git a/src/tests/job-progress.test.ts b/src/tests/job-progress.test.ts index 0df7394..b9f6ad3 100644 --- a/src/tests/job-progress.test.ts +++ b/src/tests/job-progress.test.ts @@ -15,6 +15,8 @@ function makeJob(overrides: Partial = {}): Job { outputDir: null, segmentsJson: null, error: null, + retryCount: null, + nextRetryAt: null, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), ...overrides