28 lines
896 B
JavaScript
28 lines
896 B
JavaScript
const pg = require('pg');
|
|
|
|
const pool = new pg.Pool({
|
|
connectionString: 'postgresql://edumanager:EduManager2026!Seguro@150.230.87.131:5432/edumanager'
|
|
});
|
|
|
|
async function run() {
|
|
try {
|
|
console.log('Removendo CHECK constraint antigo...');
|
|
await pool.query('ALTER TABLE prematricula_campos DROP CONSTRAINT prematricula_campos_tipo_check');
|
|
|
|
console.log('Adicionando CHECK constraint atualizado com file e banner...');
|
|
await pool.query(`
|
|
ALTER TABLE prematricula_campos
|
|
ADD CONSTRAINT prematricula_campos_tipo_check
|
|
CHECK (tipo = ANY (ARRAY['text', 'email', 'phone', 'cpf', 'date', 'select', 'textarea', 'number', 'file', 'banner']))
|
|
`);
|
|
|
|
console.log('✅ Constraint atualizado com sucesso! Tipos file e banner agora são aceitos.');
|
|
} catch (err) {
|
|
console.error('Erro:', err.message);
|
|
} finally {
|
|
await pool.end();
|
|
}
|
|
}
|
|
|
|
run();
|