테이블에 존재하는 컬럼만 업데이트
This commit is contained in:
parent
e747162058
commit
2a7066b6fd
|
|
@ -2409,11 +2409,19 @@ export class TableManagementService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SET 절 생성 (수정할 데이터) - 먼저 생성
|
// SET 절 생성 (수정할 데이터) - 먼저 생성
|
||||||
|
// 🔧 테이블에 존재하는 컬럼만 UPDATE (가상 컬럼 제외)
|
||||||
const setConditions: string[] = [];
|
const setConditions: string[] = [];
|
||||||
const setValues: any[] = [];
|
const setValues: any[] = [];
|
||||||
let paramIndex = 1;
|
let paramIndex = 1;
|
||||||
|
const skippedColumns: string[] = [];
|
||||||
|
|
||||||
Object.keys(updatedData).forEach((column) => {
|
Object.keys(updatedData).forEach((column) => {
|
||||||
|
// 테이블에 존재하지 않는 컬럼은 스킵
|
||||||
|
if (!columnTypeMap.has(column)) {
|
||||||
|
skippedColumns.push(column);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const dataType = columnTypeMap.get(column) || "text";
|
const dataType = columnTypeMap.get(column) || "text";
|
||||||
setConditions.push(
|
setConditions.push(
|
||||||
`"${column}" = $${paramIndex}::${this.getPostgreSQLType(dataType)}`
|
`"${column}" = $${paramIndex}::${this.getPostgreSQLType(dataType)}`
|
||||||
|
|
@ -2424,6 +2432,10 @@ export class TableManagementService {
|
||||||
paramIndex++;
|
paramIndex++;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (skippedColumns.length > 0) {
|
||||||
|
logger.info(`⚠️ 테이블에 존재하지 않는 컬럼 스킵: ${skippedColumns.join(", ")}`);
|
||||||
|
}
|
||||||
|
|
||||||
// WHERE 조건 생성 (PRIMARY KEY 우선, 없으면 모든 원본 데이터 사용)
|
// WHERE 조건 생성 (PRIMARY KEY 우선, 없으면 모든 원본 데이터 사용)
|
||||||
let whereConditions: string[] = [];
|
let whereConditions: string[] = [];
|
||||||
let whereValues: any[] = [];
|
let whereValues: any[] = [];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue