#!/usr/bin/env node // Migration: Add qualys_ipv6 and primary_ipv6 columns to ivanti_findings // These capture IPv6 addresses for findings that have no IPv4. // Qualys IPv6 comes from hostAdditionalDetails; Primary IPv6 from assetCustomAttributes. const pool = require('../db'); async function run() { console.log('Adding IPv6 columns to ivanti_findings...'); try { await pool.query(` ALTER TABLE ivanti_findings ADD COLUMN IF NOT EXISTS qualys_ipv6 TEXT DEFAULT NULL `); console.log('✓ qualys_ipv6 column added (or already exists)'); await pool.query(` ALTER TABLE ivanti_findings ADD COLUMN IF NOT EXISTS primary_ipv6 TEXT DEFAULT NULL `); console.log('✓ primary_ipv6 column added (or already exists)'); console.log('Migration complete.'); } catch (err) { console.error('Migration failed:', err.message); process.exit(1); } finally { await pool.end(); } } run();