36 lines
1016 B
JavaScript
36 lines
1016 B
JavaScript
/**
|
|
* system_notice 테이블 생성 마이그레이션 실행
|
|
*/
|
|
const { Pool } = require('pg');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const pool = new Pool({
|
|
connectionString: process.env.DATABASE_URL || 'postgresql://postgres:ph0909!!@39.117.244.52:11132/plm',
|
|
ssl: false,
|
|
});
|
|
|
|
async function run() {
|
|
const client = await pool.connect();
|
|
try {
|
|
const sqlPath = path.join(__dirname, '../../db/migrations/1050_create_system_notice.sql');
|
|
const sql = fs.readFileSync(sqlPath, 'utf8');
|
|
await client.query(sql);
|
|
console.log('OK: system_notice 테이블 생성 완료');
|
|
|
|
// 검증
|
|
const result = await client.query(
|
|
"SELECT column_name FROM information_schema.columns WHERE table_name='system_notice' ORDER BY ordinal_position"
|
|
);
|
|
console.log('컬럼:', result.rows.map(r => r.column_name).join(', '));
|
|
} catch (e) {
|
|
console.error('ERROR:', e.message);
|
|
process.exit(1);
|
|
} finally {
|
|
client.release();
|
|
await pool.end();
|
|
}
|
|
}
|
|
|
|
run();
|