Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
63 lines
2.1 KiB
JavaScript
63 lines
2.1 KiB
JavaScript
/**
|
|
* Migration: Add job runner metadata columns
|
|
*
|
|
* This migration adds columns to track which job runner (PG Boss or Temporal)
|
|
* executed each job, along with external identifiers for debugging and monitoring.
|
|
*
|
|
* Changes:
|
|
* - runner_type: 'pgboss' or 'temporal' to identify the execution engine
|
|
* - external_id: PG Boss job ID or Temporal workflow ID
|
|
* - external_run_id: Temporal run ID (for workflow versioning)
|
|
*/
|
|
|
|
exports.up = async (knex) => {
|
|
// Check if columns already exist to make migration idempotent
|
|
const hasRunnerType = await knex.schema.hasColumn('jobs', 'runner_type');
|
|
|
|
if (!hasRunnerType) {
|
|
await knex.schema.alterTable('jobs', (table) => {
|
|
// Track which runner executed this job
|
|
table.string('runner_type', 50).defaultTo('pgboss').notNullable();
|
|
// Store external reference (PG Boss job ID or Temporal workflow ID)
|
|
table.string('external_id', 255).nullable();
|
|
// Store Temporal run ID for workflow tracking
|
|
table.string('external_run_id', 255).nullable();
|
|
});
|
|
|
|
// Add index for external ID lookups
|
|
await knex.raw(`
|
|
CREATE INDEX IF NOT EXISTS idx_jobs_external_id
|
|
ON jobs(external_id)
|
|
WHERE external_id IS NOT NULL
|
|
`);
|
|
|
|
// Add index for runner type queries (useful for monitoring)
|
|
await knex.raw(`
|
|
CREATE INDEX IF NOT EXISTS idx_jobs_runner_type
|
|
ON jobs(runner_type)
|
|
`);
|
|
|
|
console.log('Added job runner metadata columns to jobs table');
|
|
} else {
|
|
console.log('Job runner metadata columns already exist, skipping');
|
|
}
|
|
};
|
|
|
|
exports.down = async (knex) => {
|
|
// Drop indexes first
|
|
await knex.raw('DROP INDEX IF EXISTS idx_jobs_external_id');
|
|
await knex.raw('DROP INDEX IF EXISTS idx_jobs_runner_type');
|
|
|
|
// Check if columns exist before trying to drop them
|
|
const hasRunnerType = await knex.schema.hasColumn('jobs', 'runner_type');
|
|
|
|
if (hasRunnerType) {
|
|
await knex.schema.alterTable('jobs', (table) => {
|
|
table.dropColumn('runner_type');
|
|
table.dropColumn('external_id');
|
|
table.dropColumn('external_run_id');
|
|
});
|
|
console.log('Removed job runner metadata columns from jobs table');
|
|
}
|
|
};
|