flowExecutionService 트랜잭션 처리 개선 및 데이터 변경 추적 로직 수정
This commit is contained in:
@@ -72,6 +72,11 @@ export class FlowDataMoveService {
|
||||
// 내부 DB 처리 (기존 로직)
|
||||
return await db.transaction(async (client) => {
|
||||
try {
|
||||
// 트랜잭션 세션 변수 설정 (트리거에서 changed_by 기록용)
|
||||
await client.query("SELECT set_config('app.user_id', $1, true)", [
|
||||
userId || "system",
|
||||
]);
|
||||
|
||||
// 1. 단계 정보 조회
|
||||
const fromStep = await this.flowStepService.findById(fromStepId);
|
||||
const toStep = await this.flowStepService.findById(toStepId);
|
||||
@@ -684,6 +689,14 @@ export class FlowDataMoveService {
|
||||
dbConnectionId,
|
||||
async (externalClient, dbType) => {
|
||||
try {
|
||||
// 외부 DB가 PostgreSQL인 경우에만 세션 변수 설정 시도
|
||||
if (dbType.toLowerCase() === "postgresql") {
|
||||
await externalClient.query(
|
||||
"SELECT set_config('app.user_id', $1, true)",
|
||||
[userId || "system"]
|
||||
);
|
||||
}
|
||||
|
||||
// 1. 단계 정보 조회 (내부 DB에서)
|
||||
const fromStep = await this.flowStepService.findById(fromStepId);
|
||||
const toStep = await this.flowStepService.findById(toStepId);
|
||||
|
||||
Reference in New Issue
Block a user