31 lines
875 B
JavaScript
31 lines
875 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 client = await pool.connect();
|
|
try {
|
|
await client.query(`
|
|
ALTER TABLE prematricula_config
|
|
ADD COLUMN IF NOT EXISTS exibir_email BOOLEAN DEFAULT TRUE;
|
|
|
|
ALTER TABLE prematricula_config
|
|
ADD COLUMN IF NOT EXISTS exibir_telefone BOOLEAN DEFAULT TRUE;
|
|
|
|
UPDATE prematricula_config
|
|
SET exibir_email = TRUE, exibir_telefone = TRUE
|
|
WHERE exibir_email IS NULL OR exibir_telefone IS NULL;
|
|
`);
|
|
console.log('✅ Colunas exibir_email e exibir_telefone adicionadas com sucesso!');
|
|
} catch (e) {
|
|
console.error('❌ Erro ao adicionar colunas:', e.message);
|
|
} finally {
|
|
client.release();
|
|
await pool.end();
|
|
}
|
|
}
|
|
|
|
run();
|