17 lines
689 B
JavaScript
17 lines
689 B
JavaScript
const { Pool } = require('pg');
|
|
const pool = new Pool({ connectionString: 'postgresql://edumanager:EduManager2026!Seguro@150.230.87.131:5432/edumanager' });
|
|
async function run() {
|
|
const { rows } = await pool.query('SELECT data FROM school_data LIMIT 1');
|
|
const students = rows[0].data.students || [];
|
|
let updated = 0;
|
|
for (const s of students) {
|
|
if (s.faceDescriptor && Array.isArray(s.faceDescriptor)) {
|
|
await pool.query('UPDATE alunos SET face_descriptor = $1 WHERE id = $2', [JSON.stringify(s.faceDescriptor), s.id]);
|
|
updated++;
|
|
}
|
|
}
|
|
console.log('Total alunos atualizados com face_descriptor:', updated);
|
|
await pool.end();
|
|
}
|
|
run().catch(console.error);
|