bwsamern-ohne_standortplaner/backend/list_all_tables.js

29 lines
777 B
JavaScript

const { Client } = require('pg');
async function check() {
const client = new Client({
host: '87.106.21.21',
port: 5432,
user: 'enwelo_admin',
password: 'WX1t1cgP1qK09',
database: 'enwelo'
});
try {
await client.connect();
const res = await client.query(`
SELECT schemaname, tablename
FROM pg_tables
WHERE schemaname NOT IN ('pg_catalog', 'information_schema')
ORDER BY schemaname, tablename;
`);
console.log("ALL Tables in enwelo database:");
res.rows.forEach(r => console.log(`${r.schemaname}.${r.tablename}`));
} catch (e) {
console.error("Error:", e);
} finally {
await client.end();
}
}
check();