#!/usr/bin/env node
/**
 * ax_assignments 테이블 컬럼 타입 확인 (PostgreSQL)
 * 사용: node scripts/check-ax-schema.js
 */
require("dotenv").config({ path: require("path").join(__dirname, "..", ".env") });
const { Pool } = require("pg");

const pool = new Pool({
  host: process.env.DB_HOST || "localhost",
  port: Number(process.env.DB_PORT || 5432),
  database: process.env.DB_DATABASE || "ai_web_platform",
  user: process.env.DB_USERNAME,
  password: process.env.DB_PASSWORD,
});

async function main() {
  const res = await pool.query(`
    SELECT column_name, data_type, udt_name
    FROM information_schema.columns
    WHERE table_name = 'ax_assignments'
    ORDER BY ordinal_position
  `);
  console.log("ax_assignments columns:");
  res.rows.forEach((r) => console.log(`  ${r.column_name}: ${r.data_type} (${r.udt_name})`));
  await pool.end();
}

main().catch((e) => {
  console.error(e);
  process.exit(1);
});
