Files
PM_test/scratch_db_info.js
2026-06-12 17:14:03 +09:00

35 lines
1.1 KiB
JavaScript

const pool = require("./db/pool.js");
async function run() {
const client = await pool.connect();
try {
console.log("Checking actual columns in PostgreSQL database...");
const tables = ["tb_data", "_test_tb_data", "tb_official_doc_file", "tb_download_folder"];
for (const table of tables) {
const query = `
SELECT column_name, data_type
FROM information_schema.columns
WHERE table_schema = 'ver4'
AND table_name = $1;
`;
const res = await client.query(query, [table]);
console.log(`\n--- Table: ver4.${table} ---`);
if (res.rows.length === 0) {
console.log("No columns found (table might not exist in ver4 schema).");
} else {
res.rows.forEach(row => {
console.log(` - ${row.column_name}: ${row.data_type}`);
});
}
}
} catch (err) {
console.error("Error checking columns:", err);
} finally {
client.release();
await pool.end();
}
}
run();