Fix scan_type migration: add process.exit() for standalone execution

run-all.js executes each migration as a child process via node. The migration
must call process.exit() or the pool keeps it alive and the runner times out
(exit code null).
This commit is contained in:
Jordan Ramos
2026-08-18 11:25:16 -06:00
parent abebc99914
commit 9d1d4cdeb5

View File

@@ -5,7 +5,7 @@
const pool = require('../db');
async function up() {
async function run() {
await pool.query(`
ALTER TABLE ivanti_findings
ADD COLUMN IF NOT EXISTS scan_type VARCHAR(20) DEFAULT NULL
@@ -13,4 +13,11 @@ async function up() {
console.log('[Migration] Added scan_type column to ivanti_findings');
}
module.exports = { up };
module.exports = { run };
if (require.main === module) {
run().then(() => process.exit(0)).catch((err) => {
console.error('Migration failed:', err.message);
process.exit(1);
});
}