36 lines
908 B
TypeScript
36 lines
908 B
TypeScript
import { Pool } from 'pg';
|
|
|
|
const pool = new Pool({
|
|
connectionString: 'postgresql://sail:password@localhost:5432/dutchie_menus'
|
|
});
|
|
|
|
async function checkTables() {
|
|
try {
|
|
const result = await pool.query(`
|
|
SELECT table_name
|
|
FROM information_schema.tables
|
|
WHERE table_schema = 'public'
|
|
ORDER BY table_name
|
|
`);
|
|
|
|
console.log('Tables in database:');
|
|
result.rows.forEach(r => console.log(' -', r.table_name));
|
|
|
|
// Check stores table structure
|
|
console.log('\nStores table columns:');
|
|
const storesColumns = await pool.query(`
|
|
SELECT column_name, data_type
|
|
FROM information_schema.columns
|
|
WHERE table_name = 'stores'
|
|
`);
|
|
storesColumns.rows.forEach(r => console.log(` - ${r.column_name}: ${r.data_type}`));
|
|
|
|
} catch (error: any) {
|
|
console.error('Error:', error.message);
|
|
} finally {
|
|
await pool.end();
|
|
}
|
|
}
|
|
|
|
checkTables();
|