76 lines
2.0 KiB
JavaScript
76 lines
2.0 KiB
JavaScript
/**
|
|
* dashboards 테이블 구조 확인 스크립트
|
|
*/
|
|
|
|
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 checkDashboardStructure() {
|
|
const client = await pool.connect();
|
|
|
|
try {
|
|
console.log('🔍 dashboards 테이블 구조 확인 중...\n');
|
|
|
|
// 컬럼 정보 조회
|
|
const columns = await client.query(`
|
|
SELECT
|
|
column_name,
|
|
data_type,
|
|
is_nullable,
|
|
column_default
|
|
FROM information_schema.columns
|
|
WHERE table_name = 'dashboards'
|
|
ORDER BY ordinal_position
|
|
`);
|
|
|
|
console.log('📋 dashboards 테이블 컬럼:\n');
|
|
columns.rows.forEach((col, index) => {
|
|
console.log(`${index + 1}. ${col.column_name} (${col.data_type}) - Nullable: ${col.is_nullable}`);
|
|
});
|
|
|
|
// 샘플 데이터 조회
|
|
console.log('\n📊 샘플 데이터 (첫 1개):');
|
|
const sample = await client.query(`
|
|
SELECT * FROM dashboards LIMIT 1
|
|
`);
|
|
|
|
if (sample.rows.length > 0) {
|
|
console.log(JSON.stringify(sample.rows[0], null, 2));
|
|
} else {
|
|
console.log('❌ 데이터가 없습니다.');
|
|
}
|
|
|
|
// dashboard_elements 테이블도 확인
|
|
console.log('\n🔍 dashboard_elements 테이블 구조 확인 중...\n');
|
|
|
|
const elemColumns = await client.query(`
|
|
SELECT
|
|
column_name,
|
|
data_type,
|
|
is_nullable
|
|
FROM information_schema.columns
|
|
WHERE table_name = 'dashboard_elements'
|
|
ORDER BY ordinal_position
|
|
`);
|
|
|
|
console.log('📋 dashboard_elements 테이블 컬럼:\n');
|
|
elemColumns.rows.forEach((col, index) => {
|
|
console.log(`${index + 1}. ${col.column_name} (${col.data_type}) - Nullable: ${col.is_nullable}`);
|
|
});
|
|
|
|
} catch (error) {
|
|
console.error('❌ 오류 발생:', error.message);
|
|
} finally {
|
|
client.release();
|
|
await pool.end();
|
|
}
|
|
}
|
|
|
|
checkDashboardStructure();
|
|
|