Clean init
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
const { Client } = require('pg');
|
||||
const client = new Client({
|
||||
user: 'admin',
|
||||
password: 'password',
|
||||
host: 'aisop.houseofwebsites.ai',
|
||||
database: 'sop_monitoring',
|
||||
port: 5432,
|
||||
ssl: { rejectUnauthorized: false }
|
||||
});
|
||||
client.connect()
|
||||
.then(() => {
|
||||
console.log('Connected to DB');
|
||||
return client.query("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'");
|
||||
})
|
||||
.then(res => {
|
||||
console.log('Tables:', res.rows);
|
||||
return client.query('SELECT COUNT(*) FROM events');
|
||||
})
|
||||
.then(res => {
|
||||
console.log('Events count:', res.rows[0]);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('DB Error:', err.message);
|
||||
})
|
||||
.finally(() => {
|
||||
client.end();
|
||||
});
|
||||
Reference in New Issue
Block a user