feat: migrate ServerPC data to asset_pc, enhance filters with location, and standardize page headers
- 서버PC 자산을 asset_pc 테이블로 통합 마이그레이션 및 스키마 확장 (위치, IP 정보 복구 완료) - 하드웨어 자산 페이지의 구매법인 필터를 자산위치 필터로 교체 및 동적 데이터 바인딩 적용 - 모든 자산 리스트 페이지 상단에 설명(Description) 필드 추가 및 헤더 표준화 - 상세 모달 내 삭제 버튼 기능 구현 및 서버PC 용도 필드 노출 오류 수정 - 현 사용조직 필터 리스트가 비어있던 DOM 셀렉터 버그 수정
This commit is contained in:
52
expand_pc_schema.js
Normal file
52
expand_pc_schema.js
Normal file
@@ -0,0 +1,52 @@
|
||||
import mysql from 'mysql2/promise';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
async function expandSchema() {
|
||||
const connection = await mysql.createConnection({
|
||||
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')
|
||||
});
|
||||
|
||||
try {
|
||||
console.log('🏗️ Expanding asset_pc table schema...');
|
||||
|
||||
const columnsToAdd = [
|
||||
{ name: 'location', type: 'TEXT' },
|
||||
{ name: 'location_detail', type: 'TEXT' },
|
||||
{ name: 'ip_address', type: 'TEXT' },
|
||||
{ name: 'ip_address_2', type: 'TEXT' },
|
||||
{ name: 'remote_tool', type: 'TEXT' },
|
||||
{ name: 'remote_id', type: 'TEXT' },
|
||||
{ name: 'remote_pw', type: 'TEXT' },
|
||||
{ name: 'monitoring', type: 'TEXT' },
|
||||
{ name: 'asset_purpose', type: 'TEXT' }
|
||||
];
|
||||
|
||||
for (const col of columnsToAdd) {
|
||||
try {
|
||||
await connection.query(`ALTER TABLE asset_pc ADD COLUMN \`${col.name}\` ${col.type}`);
|
||||
console.log(`✅ Added column: ${col.name}`);
|
||||
} catch (err) {
|
||||
if (err.code === 'ER_DUP_COLUMN_NAME') {
|
||||
console.log(`ℹ️ Column ${col.name} already exists.`);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('🎉 Schema expansion completed!');
|
||||
|
||||
} catch (err) {
|
||||
console.error('❌ Schema expansion failed:', err);
|
||||
} finally {
|
||||
await connection.end();
|
||||
}
|
||||
}
|
||||
|
||||
expandSchema();
|
||||
Reference in New Issue
Block a user