29 lines
822 B
JavaScript
29 lines
822 B
JavaScript
const { Client } = require('pg');
|
|
|
|
async function check() {
|
|
require('dotenv').config({ path: '../.env' });
|
|
const client = new Client({
|
|
host: process.env.DB_HOST,
|
|
port: process.env.DB_PORT,
|
|
user: process.env.DB_USER,
|
|
password: process.env.DB_PASSWORD,
|
|
database: process.env.DB_NAME
|
|
});
|
|
|
|
try {
|
|
await client.connect();
|
|
const res = await client.query(`
|
|
SELECT table_schema, table_name
|
|
FROM information_schema.tables
|
|
WHERE table_schema NOT IN ('information_schema', 'pg_catalog');
|
|
`);
|
|
console.log("Tables in geodata database:");
|
|
res.rows.forEach(r => console.log(`${r.table_schema}.${r.table_name}`));
|
|
} catch (e) {
|
|
console.error("Error:", e);
|
|
} finally {
|
|
await client.end();
|
|
}
|
|
}
|
|
check();
|