30 lines
656 B
JavaScript

const { Client } = require('pg');
require('dotenv').config();
const client = new Client(process.env.DATABASE_URL);
async function checkTables() {
try {
await client.connect();
console.log('Connected to database');
const result = await client.query(`
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
ORDER BY table_name;
`);
console.log('Available tables:');
result.rows.forEach(row => {
console.log(`- ${row.table_name}`);
});
} catch (error) {
console.error('Error checking tables:', error);
} finally {
await client.end();
}
}
checkTables();