Files
AI_Pharmacy_Api/update_old_adjs.js
T

15 lines
486 B
JavaScript

const { Pool } = require('pg');
const pool = new Pool({ connectionString: 'postgres://postgres:csh%402018@localhost:5432/ai_pharmacy' });
async function run() {
try {
await pool.query("UPDATE stock_movements SET reason_code = 'system_recovery', notes = 'Recovered past adjustment' WHERE movement_type = 'adjustment' AND notes IS NULL");
console.log('Successfully updated old adjustments!');
} catch(err) {
console.error(err);
} finally {
pool.end();
}
}
run();