38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
const { Client } = require("pg");
|
|
require("dotenv/config");
|
|
|
|
async function testDatabase() {
|
|
const client = new Client({
|
|
connectionString: process.env.DATABASE_URL,
|
|
});
|
|
|
|
try {
|
|
await client.connect();
|
|
console.log("✅ 데이터베이스 연결 성공");
|
|
|
|
// 사용자 정보 조회
|
|
const userResult = await client.query(
|
|
"SELECT user_id, user_name, status FROM user_info LIMIT 5"
|
|
);
|
|
console.log("👥 사용자 정보:", userResult.rows);
|
|
|
|
// 테이블 라벨 정보 조회
|
|
const tableLabelsResult = await client.query(
|
|
"SELECT * FROM table_labels LIMIT 5"
|
|
);
|
|
console.log("🏷️ 테이블 라벨 정보:", tableLabelsResult.rows);
|
|
|
|
// 컬럼 라벨 정보 조회
|
|
const columnLabelsResult = await client.query(
|
|
"SELECT * FROM column_labels LIMIT 5"
|
|
);
|
|
console.log("📋 컬럼 라벨 정보:", columnLabelsResult.rows);
|
|
} catch (error) {
|
|
console.error("❌ 오류 발생:", error);
|
|
} finally {
|
|
await client.end();
|
|
}
|
|
}
|
|
|
|
testDatabase();
|