20 lines
657 B
JavaScript
20 lines
657 B
JavaScript
const { Pool } = require('pg');
|
|
const pool = new Pool({ connectionString: 'postgresql://edumanager:EduManager2026!Seguro@150.230.87.131:5432/edumanager' });
|
|
async function fixAll() {
|
|
const client = await pool.connect();
|
|
try {
|
|
const { rowCount } = await client.query(`
|
|
UPDATE frequencias
|
|
SET data = data - INTERVAL '3 hours'
|
|
WHERE EXTRACT(HOUR FROM data) >= 17
|
|
AND EXTRACT(HOUR FROM data) <= 19
|
|
AND tipo = 'presence'
|
|
`);
|
|
console.log(`Corrigidas ${rowCount} presenças deslocadas pelo fuso horário (UTC -> BRT).`);
|
|
} finally {
|
|
client.release();
|
|
pool.end();
|
|
}
|
|
}
|
|
fixAll().catch(console.error);
|