24 lines
661 B
JavaScript
24 lines
661 B
JavaScript
const { Client } = require('pg');
|
|
const fs = require('fs');
|
|
|
|
const sql = fs.readFileSync('/home/deploy/stack/scoreodonto.com/backend/sql/sis_odonto_postgres.sql', 'utf8');
|
|
|
|
const client = new Client({
|
|
connectionString: 'postgresql://scoreodonto_user:clube67_scoreodonto_pass_9903@10.99.0.3:5432/scoreodonto?schema=public'
|
|
});
|
|
|
|
client.connect()
|
|
.then(() => {
|
|
console.log('Connected! Running SQL script...');
|
|
return client.query(sql);
|
|
})
|
|
.then(() => {
|
|
console.log('SQL script executed successfully!');
|
|
client.end();
|
|
})
|
|
.catch(err => {
|
|
console.error('Error executing SQL script:', err);
|
|
client.end();
|
|
process.exit(1);
|
|
});
|