32 lines
948 B
JavaScript
32 lines
948 B
JavaScript
|
|
#!/usr/bin/env node
|
||
|
|
// Migration: Add ivanti_first_name and ivanti_last_name to users table
|
||
|
|
// Allows per-user Ivanti identity for workflow filtering.
|
||
|
|
|
||
|
|
const pool = require('../db');
|
||
|
|
|
||
|
|
async function run() {
|
||
|
|
console.log('Adding Ivanti identity columns to users table...');
|
||
|
|
try {
|
||
|
|
await pool.query(`
|
||
|
|
ALTER TABLE users
|
||
|
|
ADD COLUMN IF NOT EXISTS ivanti_first_name VARCHAR(100) DEFAULT NULL
|
||
|
|
`);
|
||
|
|
console.log('✓ ivanti_first_name column added (or already exists)');
|
||
|
|
|
||
|
|
await pool.query(`
|
||
|
|
ALTER TABLE users
|
||
|
|
ADD COLUMN IF NOT EXISTS ivanti_last_name VARCHAR(100) DEFAULT NULL
|
||
|
|
`);
|
||
|
|
console.log('✓ ivanti_last_name 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();
|