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:
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user