37 lines
995 B
JavaScript
37 lines
995 B
JavaScript
const { Client } = require('pg');
|
|
|
|
const client = new Client({
|
|
host: '66.116.207.225',
|
|
port: 5433,
|
|
database: 'nearledb',
|
|
user: 'admin',
|
|
password: 'Package@123#',
|
|
ssl: false,
|
|
});
|
|
|
|
async function main() {
|
|
try {
|
|
await client.connect();
|
|
console.log('Connected successfully!');
|
|
|
|
console.log('\n--- Updating orders 140533 and 140534 to "created" status ---');
|
|
const updateRes = await client.query(
|
|
"UPDATE orders SET orderstatus = 'created', pending = '' WHERE orderheaderid IN (140533, 140534)"
|
|
);
|
|
console.log(`Updated ${updateRes.rowCount} orders.`);
|
|
|
|
console.log('\n--- Verification ---');
|
|
const verifyRes = await client.query(
|
|
"SELECT orderheaderid, orderid, orderstatus, pending, processing, ready, delivered, cancelled FROM orders WHERE orderheaderid IN (140533, 140534)"
|
|
);
|
|
console.table(verifyRes.rows);
|
|
|
|
} catch (err) {
|
|
console.error('Error executing update:', err);
|
|
} finally {
|
|
await client.end();
|
|
}
|
|
}
|
|
|
|
main();
|