- Infoblox WAPI integration (read-only) for resolving IPs to FQDNs - backend/helpers/infobloxApi.js — Basic auth, host/PTR/IPv6 lookups - backend/routes/infoblox.js — /api/infoblox endpoints - Globe icon on Reporting page hostName/dns columns for one-click DNS lookup - Pending: WAPI credentials with API access permissions - Scan Posture page for Access Ops platform/version tracking - backend/routes/scanPosture.js - frontend/src/components/pages/ScanPosturePage.js - Page visibility and nav drawer entries - Ivanti findings OS field enrichment - Migration to add os_name/os_class/os_version columns - Backfill script for existing findings - ivantiFindings route updates to persist OS data on sync
76 lines
2.4 KiB
JavaScript
76 lines
2.4 KiB
JavaScript
#!/usr/bin/env node
|
|
// Run all Postgres-compatible migrations in order.
|
|
// Each migration is idempotent (safe to re-run).
|
|
// Used by CI/CD pipeline during deploy to ensure schema is up to date.
|
|
//
|
|
// Usage: cd backend && node migrations/run-all.js
|
|
|
|
const { execSync } = require('child_process');
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
|
|
const MIGRATIONS_DIR = __dirname;
|
|
|
|
// Only run migrations that use the Postgres pool (not legacy SQLite ones).
|
|
// Add new migrations to this list as they're created.
|
|
const POSTGRES_MIGRATIONS = [
|
|
'add_decom_workflow_type.js',
|
|
'add_fp_submissions_dismissed.js',
|
|
'add_fp_submissions_requeued_at.js',
|
|
'add_vcl_reporting_columns.js',
|
|
'add_vcl_vertical_metadata.js',
|
|
'add_vcl_multi_vertical.js',
|
|
'add_compliance_item_history.js',
|
|
'add_jira_sync_columns_pg.js',
|
|
'add_flexible_jira_ticket_creation.js',
|
|
'add_multi_item_jira_ticket.js',
|
|
'drop_jira_status_check_constraint.js',
|
|
'add_compliance_history_metric_id.js',
|
|
'add_archer_templates_table.js',
|
|
'add_queue_remediation_notes_table.js',
|
|
'add_remediate_workflow_type.js',
|
|
'add_notifications_table.js',
|
|
'add_ivanti_findings_ipv6_columns.js',
|
|
'add_user_ivanti_identity.js',
|
|
'add_atlas_known_column.js',
|
|
'add_session_impersonation.js',
|
|
'add_supplemental_tables.js',
|
|
'add_supplemental_metadata.js',
|
|
'add_ivanti_findings_scan_type.js',
|
|
'unify_tickets_table.js',
|
|
'add_ivanti_os_fields.js',
|
|
];
|
|
|
|
async function runAll() {
|
|
console.log(`[Migrations] Running ${POSTGRES_MIGRATIONS.length} Postgres migration(s)...`);
|
|
let succeeded = 0;
|
|
let failed = 0;
|
|
|
|
for (const file of POSTGRES_MIGRATIONS) {
|
|
const fullPath = path.join(MIGRATIONS_DIR, file);
|
|
if (!fs.existsSync(fullPath)) {
|
|
console.error(` [FAIL] ${file}: file not found`);
|
|
failed++;
|
|
continue;
|
|
}
|
|
|
|
try {
|
|
console.log(` [run] ${file}`);
|
|
execSync(`node ${fullPath}`, {
|
|
cwd: path.join(MIGRATIONS_DIR, '..'),
|
|
stdio: 'inherit',
|
|
timeout: 30000,
|
|
});
|
|
succeeded++;
|
|
} catch (err) {
|
|
console.error(` [FAIL] ${file}: exit code ${err.status}`);
|
|
failed++;
|
|
}
|
|
}
|
|
|
|
console.log(`[Migrations] Done: ${succeeded} applied, ${failed} failed`);
|
|
if (failed > 0) process.exit(1);
|
|
}
|
|
|
|
runAll();
|