feature/v2-renewal #400
|
|
@ -345,11 +345,13 @@ app.listen(PORT, HOST, async () => {
|
||||||
runDashboardMigration,
|
runDashboardMigration,
|
||||||
runTableHistoryActionMigration,
|
runTableHistoryActionMigration,
|
||||||
runDtgManagementLogMigration,
|
runDtgManagementLogMigration,
|
||||||
|
runApprovalSystemMigration,
|
||||||
} = await import("./database/runMigration");
|
} = await import("./database/runMigration");
|
||||||
|
|
||||||
await runDashboardMigration();
|
await runDashboardMigration();
|
||||||
await runTableHistoryActionMigration();
|
await runTableHistoryActionMigration();
|
||||||
await runDtgManagementLogMigration();
|
await runDtgManagementLogMigration();
|
||||||
|
await runApprovalSystemMigration();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`❌ 마이그레이션 실패:`, error);
|
logger.error(`❌ 마이그레이션 실패:`, error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,37 @@ import { PostgreSQLService } from "./PostgreSQLService";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 결재 시스템 테이블 마이그레이션
|
||||||
|
* approval_definitions, approval_line_templates, approval_line_template_steps,
|
||||||
|
* approval_requests, approval_lines 테이블 생성
|
||||||
|
*/
|
||||||
|
export async function runApprovalSystemMigration() {
|
||||||
|
try {
|
||||||
|
console.log("🔄 결재 시스템 마이그레이션 시작...");
|
||||||
|
|
||||||
|
const sqlFilePath = path.join(
|
||||||
|
__dirname,
|
||||||
|
"../../db/migrations/100_create_approval_system.sql"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!fs.existsSync(sqlFilePath)) {
|
||||||
|
console.log("⚠️ 마이그레이션 파일이 없습니다:", sqlFilePath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sqlContent = fs.readFileSync(sqlFilePath, "utf8");
|
||||||
|
await PostgreSQLService.query(sqlContent);
|
||||||
|
|
||||||
|
console.log("✅ 결재 시스템 마이그레이션 완료!");
|
||||||
|
} catch (error) {
|
||||||
|
console.error("❌ 결재 시스템 마이그레이션 실패:", error);
|
||||||
|
if (error instanceof Error && error.message.includes("already exists")) {
|
||||||
|
console.log("ℹ️ 테이블이 이미 존재합니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 데이터베이스 마이그레이션 실행
|
* 데이터베이스 마이그레이션 실행
|
||||||
* dashboard_elements 테이블에 custom_title, show_header 컬럼 추가
|
* dashboard_elements 테이블에 custom_title, show_header 컬럼 추가
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue