- DB 테이블명 변경 마이그레이션 스크립트 추가 (migrate_v5_rename_remote.js) - Backend (server.js): 쿼리 및 매핑 로직을 asset_remote 및 remotes 속성으로 업데이트 - Frontend (HWModal.ts): 폼 필드와 데이터 바인딩을 remotes로 일괄 수정 - 유틸리티 스크립트의 레퍼런스 일괄 업데이트
29 lines
718 B
JavaScript
29 lines
718 B
JavaScript
import mysql from 'mysql2/promise';
|
|
import dotenv from 'dotenv';
|
|
|
|
dotenv.config();
|
|
|
|
const pool = mysql.createPool({
|
|
host: process.env.DB_HOST,
|
|
user: process.env.DB_USER,
|
|
password: process.env.DB_PASS,
|
|
database: process.env.DB_NAME,
|
|
port: parseInt(process.env.DB_PORT || '3306'),
|
|
});
|
|
|
|
async function migrate() {
|
|
const conn = await pool.getConnection();
|
|
try {
|
|
console.log('1. Renaming asset_network to asset_remote...');
|
|
await conn.query('RENAME TABLE asset_network TO asset_remote');
|
|
console.log('✅ Table renamed successfully.');
|
|
} catch (e) {
|
|
console.error('Migration failed:', e);
|
|
} finally {
|
|
conn.release();
|
|
pool.end();
|
|
}
|
|
}
|
|
|
|
migrate();
|