데이터 매핑 설정 중간커밋
This commit is contained in:
34
backend-node/scripts/add-data-mapping-column.js
Normal file
34
backend-node/scripts/add-data-mapping-column.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const { PrismaClient } = require("@prisma/client");
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function addDataMappingColumn() {
|
||||
try {
|
||||
console.log(
|
||||
"🔄 external_call_configs 테이블에 data_mapping_config 컬럼 추가 중..."
|
||||
);
|
||||
|
||||
// data_mapping_config JSONB 컬럼 추가
|
||||
await prisma.$executeRaw`
|
||||
ALTER TABLE external_call_configs
|
||||
ADD COLUMN IF NOT EXISTS data_mapping_config JSONB
|
||||
`;
|
||||
|
||||
console.log("✅ data_mapping_config 컬럼이 성공적으로 추가되었습니다.");
|
||||
|
||||
// 기존 레코드에 기본값 설정
|
||||
await prisma.$executeRaw`
|
||||
UPDATE external_call_configs
|
||||
SET data_mapping_config = '{"direction": "none"}'::jsonb
|
||||
WHERE data_mapping_config IS NULL
|
||||
`;
|
||||
|
||||
console.log("✅ 기존 레코드에 기본값이 설정되었습니다.");
|
||||
} catch (error) {
|
||||
console.error("❌ 컬럼 추가 실패:", error);
|
||||
} finally {
|
||||
await prisma.$disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
addDataMappingColumn();
|
||||
Reference in New Issue
Block a user