배경: item_info에 wace 마이그레이션(numeric id 8,179건) + RPS 자체 등록(UUID 21k건)이 섞여 있어 PartSelect/그리드 JOIN에서 잡 데이터(-20260126-, 00 등)와 RPS 자체 등록 데이터가 노출됨. wace 도메인 메뉴는 part_mng만 참조하도록 분리. 개발관리 등 다른 wace 메뉴도 동일 테이블 활용. 변경: - DDL: docs/migration/sales/ddl-extracted/105_create_part_mng.sql (item_info의 numeric id 데이터를 part_mng로 컬럼 매핑 INSERT, 8,176건 적재) - backend service JOIN 6곳 교체: item_info IT → part_mng PM (PM.objid::varchar = CI.part_objid) · salesEstimateService.ts (getList LATERAL JOIN, getById 라인 조회 — 2곳) · salesOrderMgmtService.ts (getList, getById, getOrderFormView, createProjectsFromContract — 4곳) - /sales/parts endpoint: part_mng SELECT + status active/release/활성 필터. 반환 키는 기존 호환을 위해 id/item_number/item_name으로 alias (objid::varchar/part_no/part_name). - 자동 검증: scripts/verify-part-mng.sql (카운트·JOIN·그리드 SQL·잡 데이터 제거 검증) 영향: - item_info는 그대로 — RPS 자체 메뉴(/sales/sales-item 등) 전용으로 유지 - ecrMngService, wacePlmDataImportService 등 RPS 다른 모듈은 이미 part_mng 사용 가정 → 자연 활성화 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
추출된 DDL (wace_plm 운영 DB)
추출일: 2026-05-07 출처:
211.115.91.141:11133/waceplm(PostgreSQL 16.8) 추출 방법: information_schema 쿼리 (pg_dump 14↔16 버전 불일치로 직접 추출 불가)
db/dbexport.pgsql(2026-03-26 시점)에 누락된 테이블을 운영 DB에서 직접 추출해 재구성.
파일 목록
| 파일 | 테이블 | 비고 |
|---|---|---|
100_create_estimate_template.sql |
estimate_template, estimate_template_item |
견적관리(estimateList_new) 메인. 운영 5건 |
101_create_sales_registration.sql |
sales_registration, shipment_log |
판매·매출관리 메인. 운영 10건 / 0건 |
102_create_mail_log.sql |
mail_log |
메일 이력. 운영 7,805건. PK 없음 |
103_create_contract_mgmt.sql |
contract_mgmt, contract_item, contract_item_serial, contract_mgmt_option |
영업/계약 헤더+라인+시리얼+옵션 (견적/주문/판매/매출 공통 헤더) |
운영 데이터 카운트 (참고)
estimate_template : 5
estimate_template_item : 7
sales_registration : 10
shipment_log : 0
mail_log : 7,805
→ 견적/판매 도메인은 사실상 신규 시스템. 데이터 이주 부담 거의 없음.
핵심 발견
1. 매출관리(revenue)는 별도 테이블이 아님
기존 04-revenue.md에서는 final_data, end_count, tax_invoice_*, transaction_statement_* 같은 별도 테이블을 가정했으나, 실제로는 모두 shipment_log 컬럼으로 존재:
| 매출관리 항목 | 위치 |
|---|---|
| 매출마감일 | shipment_log.sales_deadline_date (varchar 10) |
| 과세구분 | shipment_log.tax_type |
| 세금계산서 발행일 | shipment_log.tax_invoice_date |
| 수출신고필증 번호 | shipment_log.export_decl_no |
| 선적일자 | shipment_log.loading_date |
| 매출전표일 | shipment_log.sales_slip_date |
| 매출전표 menu_sq | shipment_log.sales_slip_menu_sq |
→ 마감/세금계산서/수출신고는 shipment_log 행 INSERT/UPDATE로 처리.
2. sales_registration ↔ shipment_log 관계
sales_registration(PKsale_noBIGSERIAL, UNIQUEproject_no) — 프로젝트당 1건 헤더shipment_log(PKlog_idBIGSERIAL, FKparent_sale_no→ sales_registration.sale_no) — 분할출하·매출 이력 라인is_split_record기본값true— 즉 shipment_log는 기본이 분할 레코드 가정target_objid→contract_mgmt.objid(FK처럼 사용)
3. estimate_template은 contract_objid로 묶임
- 1 contract → N templates (
template_type='1'=일반,'2'=장비, 추가가능) categories_json컬럼에 그룹/소그룹 구조 저장 (JSON)manager_name,manager_contact,note_remarks,show_total_row등은database/add_manager_info_to_estimate_template.sql에 별도 ALTER로 추가됐던 컬럼들 — DDL에 통합됨
4. mail_log는 PK 없음
운영에서 PK 없이 사용 중. vexplor_rps에는 마이그레이션 시 id BIGSERIAL PRIMARY KEY 추가 권장.
사용
# vexplor_rps DB에 적용 (테스트 환경 먼저 권장)
psql -h <vexplor_rps_host> -U <user> -d <db> -f 100_create_estimate_template.sql
psql -h <vexplor_rps_host> -U <user> -d <db> -f 101_create_sales_registration.sql
psql -h <vexplor_rps_host> -U <user> -d <db> -f 102_create_mail_log.sql
db/migrations/ 정식 위치로 옮길 때는 vexplor_rps 마이그레이션 번호 체계에 맞춰 파일명 변경.
추출 명령 재현
서버가 PG 16, 로컬 pg_dump가 PG 14인 경우 pg_dump가 실패하므로 information_schema 쿼리로 추출:
PGPASSWORD='<pwd>' psql -h 211.115.91.141 -p 11133 -U postgres -d waceplm -t -A -F '|' -c "
SELECT table_name||'|'||column_name||'|'||data_type||'|'||COALESCE(character_maximum_length::text,'')||'|'||is_nullable||'|'||COALESCE(column_default,'')
FROM information_schema.columns
WHERE table_schema='public' AND table_name IN ('estimate_template','estimate_template_item','sales_registration','shipment_log','mail_log')
ORDER BY table_name, ordinal_position;"
PK/UNIQUE는 information_schema.table_constraints + key_column_usage,
인덱스는 pg_indexes, 시퀀스는 information_schema.sequences,
컬럼 코멘트는 pg_description JOIN.