56 lines
1.4 KiB
JavaScript
56 lines
1.4 KiB
JavaScript
/**
|
|
* 데이터베이스 테이블 확인 스크립트
|
|
*/
|
|
|
|
const { Pool } = require('pg');
|
|
|
|
const databaseUrl = process.env.DATABASE_URL || 'postgresql://postgres:ph0909!!@39.117.244.52:11132/plm';
|
|
|
|
const pool = new Pool({
|
|
connectionString: databaseUrl,
|
|
});
|
|
|
|
async function checkTables() {
|
|
const client = await pool.connect();
|
|
|
|
try {
|
|
console.log('🔍 데이터베이스 테이블 확인 중...\n');
|
|
|
|
// 테이블 목록 조회
|
|
const result = await client.query(`
|
|
SELECT table_name
|
|
FROM information_schema.tables
|
|
WHERE table_schema = 'public'
|
|
ORDER BY table_name
|
|
`);
|
|
|
|
console.log(`📊 총 ${result.rows.length}개의 테이블 발견:\n`);
|
|
result.rows.forEach((row, index) => {
|
|
console.log(`${index + 1}. ${row.table_name}`);
|
|
});
|
|
|
|
// dashboard 관련 테이블 검색
|
|
console.log('\n🔎 dashboard 관련 테이블:');
|
|
const dashboardTables = result.rows.filter(row =>
|
|
row.table_name.toLowerCase().includes('dashboard')
|
|
);
|
|
|
|
if (dashboardTables.length === 0) {
|
|
console.log('❌ dashboard 관련 테이블을 찾을 수 없습니다.');
|
|
} else {
|
|
dashboardTables.forEach(row => {
|
|
console.log(`✅ ${row.table_name}`);
|
|
});
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('❌ 오류 발생:', error.message);
|
|
} finally {
|
|
client.release();
|
|
await pool.end();
|
|
}
|
|
}
|
|
|
|
checkTables();
|
|
|