import { Client } from 'pg'; const client = new Client({ connectionString: 'postgresql://postgres:JsdPCZiC1C56Sz@localhost:5433/postgres', ssl: false }); async function test() { try { console.log('Connecting to database...'); await client.connect(); console.log('Connected successfully!'); console.log('Listing tables in public schema...'); const res = await client.query(` SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' ORDER BY table_name; `); if (res.rows.length === 0) { console.log('No tables found in public schema!'); } else { console.log('Tables found:'); res.rows.forEach(row => console.log(`- ${row.table_name}`)); } // Check user count if user table exists if (res.rows.find(r => r.table_name === 'user')) { const userCount = await client.query('SELECT count(*) FROM "user"'); console.log(`User count: ${userCount.rows[0].count}`); } } catch (err) { console.error('Connection error:', err); } finally { await client.end(); } } test();