리비전 페이지 제거 및 트랜잭션 오류 임시 수정
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled
- frontend/src/pages/revision/ 폴더 완전 삭제 - EnhancedRevisionPage.css 제거 - support_details 저장 시 트랜잭션 오류로 인해 임시로 상세 정보 저장 비활성화 - 리비전 기능 재설계 예정
This commit is contained in:
@@ -51,7 +51,15 @@ class DockerMigrator:
|
||||
if self._check_and_create_detail_tables(cursor):
|
||||
fixes_applied.append("누락된 상세 테이블들 생성")
|
||||
|
||||
# 5. 기타 필요한 수정사항들...
|
||||
# 5. 리비전 관리 테이블들 체크 및 생성
|
||||
if self._check_and_create_revision_tables(cursor):
|
||||
fixes_applied.append("리비전 관리 테이블들 생성")
|
||||
|
||||
# 6. PIPE 관련 테이블들 체크 및 생성
|
||||
if self._check_and_create_pipe_tables(cursor):
|
||||
fixes_applied.append("PIPE 관련 테이블들 생성")
|
||||
|
||||
# 7. 기타 필요한 수정사항들...
|
||||
# 향후 추가될 수 있는 다른 스키마 수정사항들
|
||||
|
||||
conn.commit()
|
||||
@@ -382,6 +390,256 @@ class DockerMigrator:
|
||||
print(f"❌ 테이블 확인 실패: {e}")
|
||||
return False
|
||||
|
||||
def _check_and_create_revision_tables(self, cursor):
|
||||
"""간단한 리비전 관리 테이블들 체크 및 생성"""
|
||||
print("🔍 간단한 리비전 관리 테이블들 확인 중...")
|
||||
|
||||
revision_tables = {
|
||||
'simple_revision_comparisons': '''
|
||||
CREATE TABLE simple_revision_comparisons (
|
||||
id SERIAL PRIMARY KEY,
|
||||
job_no VARCHAR(50) NOT NULL,
|
||||
current_file_id INTEGER REFERENCES files(id) NOT NULL,
|
||||
previous_file_id INTEGER REFERENCES files(id) NOT NULL,
|
||||
category VARCHAR(50) NOT NULL,
|
||||
added_count INTEGER DEFAULT 0,
|
||||
removed_count INTEGER DEFAULT 0,
|
||||
changed_count INTEGER DEFAULT 0,
|
||||
unchanged_count INTEGER DEFAULT 0,
|
||||
purchased_affected INTEGER DEFAULT 0,
|
||||
unpurchased_affected INTEGER DEFAULT 0,
|
||||
inventory_count INTEGER DEFAULT 0,
|
||||
comparison_data JSONB,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
created_by_username VARCHAR(100)
|
||||
);
|
||||
CREATE INDEX idx_simple_revision_comparisons_job_no ON simple_revision_comparisons(job_no);
|
||||
CREATE INDEX idx_simple_revision_comparisons_category ON simple_revision_comparisons(category);
|
||||
''',
|
||||
'simple_revision_materials': '''
|
||||
CREATE TABLE simple_revision_materials (
|
||||
id SERIAL PRIMARY KEY,
|
||||
comparison_id INTEGER REFERENCES simple_revision_comparisons(id) NOT NULL,
|
||||
material_id INTEGER REFERENCES materials(id),
|
||||
change_type VARCHAR(20) NOT NULL,
|
||||
revision_action VARCHAR(30),
|
||||
quantity_before NUMERIC(10,3),
|
||||
quantity_after NUMERIC(10,3),
|
||||
quantity_difference NUMERIC(10,3),
|
||||
purchase_status VARCHAR(20),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
CREATE INDEX idx_simple_revision_materials_comparison ON simple_revision_materials(comparison_id);
|
||||
''',
|
||||
}
|
||||
|
||||
created_tables = []
|
||||
|
||||
for table_name, create_sql in revision_tables.items():
|
||||
# 테이블 존재 확인
|
||||
cursor.execute("""
|
||||
SELECT EXISTS (
|
||||
SELECT FROM information_schema.tables
|
||||
WHERE table_name = %s
|
||||
)
|
||||
""", (table_name,))
|
||||
|
||||
result = cursor.fetchone()
|
||||
if isinstance(result, dict):
|
||||
table_exists = result.get('exists', False)
|
||||
else:
|
||||
table_exists = result[0] if result else False
|
||||
|
||||
if not table_exists:
|
||||
# 테이블 생성
|
||||
cursor.execute(create_sql)
|
||||
created_tables.append(table_name)
|
||||
print(f" 🏗️ {table_name} 테이블 생성됨")
|
||||
|
||||
if created_tables:
|
||||
print(f"✅ {len(created_tables)}개 리비전 관리 테이블 생성 완료")
|
||||
return True
|
||||
else:
|
||||
print("✅ 모든 리비전 관리 테이블이 이미 존재합니다")
|
||||
return False
|
||||
|
||||
def _check_and_create_pipe_tables(self, cursor):
|
||||
"""PIPE 관련 테이블들 체크 및 생성"""
|
||||
print("🔍 PIPE 관련 테이블들 확인 중...")
|
||||
|
||||
pipe_tables = {
|
||||
'pipe_cutting_plans': '''
|
||||
CREATE TABLE pipe_cutting_plans (
|
||||
id SERIAL PRIMARY KEY,
|
||||
job_no VARCHAR(50) NOT NULL,
|
||||
file_id INTEGER REFERENCES files(id) NOT NULL,
|
||||
area VARCHAR(20) NOT NULL,
|
||||
drawing_name VARCHAR(100) NOT NULL,
|
||||
line_number VARCHAR(50),
|
||||
pipe_info TEXT,
|
||||
length NUMERIC(10,3),
|
||||
end_preparation VARCHAR(20),
|
||||
status VARCHAR(20) DEFAULT 'draft',
|
||||
cutting_status VARCHAR(20) DEFAULT 'not_cut',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
created_by VARCHAR(100)
|
||||
);
|
||||
CREATE INDEX idx_pipe_cutting_plans_job_no ON pipe_cutting_plans(job_no);
|
||||
CREATE INDEX idx_pipe_cutting_plans_drawing ON pipe_cutting_plans(drawing_name);
|
||||
''',
|
||||
'pipe_revision_comparisons': '''
|
||||
CREATE TABLE pipe_revision_comparisons (
|
||||
id SERIAL PRIMARY KEY,
|
||||
job_no VARCHAR(50) NOT NULL,
|
||||
current_cutting_plan_id INTEGER REFERENCES pipe_cutting_plans(id),
|
||||
previous_cutting_plan_id INTEGER REFERENCES pipe_cutting_plans(id),
|
||||
drawing_name VARCHAR(100) NOT NULL,
|
||||
has_changes BOOLEAN DEFAULT FALSE,
|
||||
total_pipes_current INTEGER DEFAULT 0,
|
||||
total_pipes_previous INTEGER DEFAULT 0,
|
||||
added_pipes INTEGER DEFAULT 0,
|
||||
removed_pipes INTEGER DEFAULT 0,
|
||||
changed_pipes INTEGER DEFAULT 0,
|
||||
unchanged_pipes INTEGER DEFAULT 0,
|
||||
comparison_details JSONB,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
CREATE INDEX idx_pipe_revision_comparisons_job_no ON pipe_revision_comparisons(job_no);
|
||||
''',
|
||||
'pipe_revision_changes': '''
|
||||
CREATE TABLE pipe_revision_changes (
|
||||
id SERIAL PRIMARY KEY,
|
||||
comparison_id INTEGER REFERENCES pipe_revision_comparisons(id) NOT NULL,
|
||||
change_type VARCHAR(20) NOT NULL,
|
||||
drawing_name VARCHAR(100) NOT NULL,
|
||||
line_number VARCHAR(50),
|
||||
pipe_info TEXT,
|
||||
length NUMERIC(10,3),
|
||||
end_preparation VARCHAR(20),
|
||||
old_data JSONB,
|
||||
new_data JSONB,
|
||||
cutting_status VARCHAR(20) DEFAULT 'not_cut',
|
||||
impact_on_material_requirement JSONB,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
''',
|
||||
'pipe_drawing_issues': '''
|
||||
CREATE TABLE pipe_drawing_issues (
|
||||
id SERIAL PRIMARY KEY,
|
||||
job_no VARCHAR(50) NOT NULL,
|
||||
snapshot_id INTEGER REFERENCES pipe_issue_snapshots(id),
|
||||
area VARCHAR(20) NOT NULL,
|
||||
drawing_name VARCHAR(100) NOT NULL,
|
||||
issue_description TEXT NOT NULL,
|
||||
severity VARCHAR(20) DEFAULT 'normal',
|
||||
status VARCHAR(20) DEFAULT 'open',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
created_by VARCHAR(100),
|
||||
resolved_by VARCHAR(100),
|
||||
resolved_at TIMESTAMP
|
||||
);
|
||||
CREATE INDEX idx_pipe_drawing_issues_job_no ON pipe_drawing_issues(job_no);
|
||||
''',
|
||||
'pipe_segment_issues': '''
|
||||
CREATE TABLE pipe_segment_issues (
|
||||
id SERIAL PRIMARY KEY,
|
||||
job_no VARCHAR(50) NOT NULL,
|
||||
snapshot_id INTEGER REFERENCES pipe_issue_snapshots(id),
|
||||
area VARCHAR(20) NOT NULL,
|
||||
drawing_name VARCHAR(100) NOT NULL,
|
||||
line_no VARCHAR(50) NOT NULL,
|
||||
pipe_info TEXT NOT NULL,
|
||||
length NUMERIC(10,3) NOT NULL,
|
||||
issue_description TEXT NOT NULL,
|
||||
issue_type VARCHAR(30),
|
||||
severity VARCHAR(20) DEFAULT 'normal',
|
||||
status VARCHAR(20) DEFAULT 'open',
|
||||
resolution_action TEXT,
|
||||
length_adjustment NUMERIC(10,3),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
created_by VARCHAR(100),
|
||||
resolved_by VARCHAR(100),
|
||||
resolved_at TIMESTAMP
|
||||
);
|
||||
CREATE INDEX idx_pipe_segment_issues_job_no ON pipe_segment_issues(job_no);
|
||||
''',
|
||||
'pipe_issue_snapshots': '''
|
||||
CREATE TABLE pipe_issue_snapshots (
|
||||
id SERIAL PRIMARY KEY,
|
||||
job_no VARCHAR(50) NOT NULL,
|
||||
snapshot_name VARCHAR(200),
|
||||
cutting_plan_finalized_at TIMESTAMP NOT NULL,
|
||||
is_locked BOOLEAN DEFAULT TRUE,
|
||||
snapshot_data JSONB,
|
||||
total_segments INTEGER DEFAULT 0,
|
||||
total_drawings INTEGER DEFAULT 0,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
created_by VARCHAR(100),
|
||||
description TEXT
|
||||
);
|
||||
CREATE INDEX idx_pipe_issue_snapshots_job_no ON pipe_issue_snapshots(job_no);
|
||||
'''
|
||||
}
|
||||
|
||||
created_tables = []
|
||||
|
||||
# pipe_issue_snapshots를 먼저 생성 (다른 테이블들이 참조하므로)
|
||||
priority_tables = ['pipe_issue_snapshots', 'pipe_cutting_plans']
|
||||
|
||||
# 우선순위 테이블들 먼저 생성
|
||||
for table_name in priority_tables:
|
||||
if table_name in pipe_tables:
|
||||
cursor.execute("""
|
||||
SELECT EXISTS (
|
||||
SELECT FROM information_schema.tables
|
||||
WHERE table_name = %s
|
||||
)
|
||||
""", (table_name,))
|
||||
|
||||
result = cursor.fetchone()
|
||||
if isinstance(result, dict):
|
||||
table_exists = result.get('exists', False)
|
||||
else:
|
||||
table_exists = result[0] if result else False
|
||||
|
||||
if not table_exists:
|
||||
cursor.execute(pipe_tables[table_name])
|
||||
created_tables.append(table_name)
|
||||
print(f" 🏗️ {table_name} 테이블 생성됨")
|
||||
|
||||
# 나머지 테이블들 생성
|
||||
for table_name, create_sql in pipe_tables.items():
|
||||
if table_name in priority_tables:
|
||||
continue # 이미 처리됨
|
||||
|
||||
cursor.execute("""
|
||||
SELECT EXISTS (
|
||||
SELECT FROM information_schema.tables
|
||||
WHERE table_name = %s
|
||||
)
|
||||
""", (table_name,))
|
||||
|
||||
result = cursor.fetchone()
|
||||
if isinstance(result, dict):
|
||||
table_exists = result.get('exists', False)
|
||||
else:
|
||||
table_exists = result[0] if result else False
|
||||
|
||||
if not table_exists:
|
||||
cursor.execute(create_sql)
|
||||
created_tables.append(table_name)
|
||||
print(f" 🏗️ {table_name} 테이블 생성됨")
|
||||
|
||||
if created_tables:
|
||||
print(f"✅ {len(created_tables)}개 PIPE 관련 테이블 생성 완료")
|
||||
return True
|
||||
else:
|
||||
print("✅ 모든 PIPE 관련 테이블이 이미 존재합니다")
|
||||
return False
|
||||
|
||||
def main():
|
||||
print("🚀 Docker 환경 마이그레이션 시작")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user