Files
AI_Pharmacy_Api/alter_db.js
T

19 lines
508 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('ALTER TABLE stock_movements ADD COLUMN IF NOT EXISTS reason_code VARCHAR(100)');
await pool.query('ALTER TABLE stock_movements ADD COLUMN IF NOT EXISTS notes TEXT');
console.log('Successfully added columns.');
} catch (err) {
console.error('Error:', err);
} finally {
pool.end();
}
}
run();