🔄 전반적인 시스템 리팩토링 완료
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled

 백엔드 구조 개선:
- DatabaseService: 공통 DB 쿼리 로직 통합
- FileUploadService: 파일 업로드 로직 모듈화 및 트랜잭션 관리 개선
- 서비스 레이어 패턴 도입으로 코드 재사용성 향상

 프론트엔드 컴포넌트 개선:
- LoadingSpinner, ErrorMessage, ConfirmDialog 공통 컴포넌트 생성
- 재사용 가능한 컴포넌트 라이브러리 구축
- deprecated/backup 파일들 완전 제거

 성능 최적화:
- optimize_database.py: 핵심 DB 인덱스 자동 생성
- 쿼리 최적화 및 통계 업데이트 자동화
- VACUUM ANALYZE 자동 실행

 코드 정리:
- 개별 SQL 마이그레이션 파일들을 legacy/ 폴더로 정리
- 중복된 마이그레이션 스크립트 정리
- 깔끔하고 체계적인 프로젝트 구조 완성

 자동 마이그레이션 시스템 강화:
- complete_migrate.py: SQLAlchemy 기반 완전한 마이그레이션
- analyze_and_fix_schema.py: 백엔드 코드 분석 기반 스키마 수정
- fix_missing_tables.py: 누락된 테이블/컬럼 자동 생성
- start.sh: 배포 시 자동 실행 순서 최적화
This commit is contained in:
Hyungi Ahn
2025-10-20 08:41:06 +09:00
parent 0c99697a6f
commit 3398f71b80
61 changed files with 3370 additions and 4512 deletions

View File

@@ -0,0 +1,73 @@
#!/usr/bin/env python3
"""
전체 데이터베이스 설정 및 더미 데이터 생성
"""
import sys
import os
from sqlalchemy import create_engine, text
# 프로젝트 루트를 Python path에 추가
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
def setup_database():
"""데이터베이스 전체 설정"""
try:
from app.database import engine
print("✅ 기존 데이터베이스 연결 사용")
except ImportError:
# 개발용 직접 연결
DATABASE_URL = "sqlite:///./test.db"
engine = create_engine(DATABASE_URL)
print("⚠️ 개발용 SQLite 연결")
try:
with engine.connect() as conn:
print("🏗️ 1단계: jobs 테이블 생성...")
# jobs 테이블 생성 SQL 실행
with open('scripts/01_create_jobs_table.sql', 'r', encoding='utf-8') as f:
sql_commands = f.read().split(';')
for command in sql_commands:
command = command.strip()
if command:
conn.execute(text(command))
print("✅ jobs 테이블 생성 완료")
print("🔧 2단계: files 테이블 수정...")
# files 테이블 수정 (선택적)
try:
with open('scripts/02_modify_files_table.sql', 'r', encoding='utf-8') as f:
sql_commands = f.read().split(';')
for command in sql_commands:
command = command.strip()
if command and not command.startswith('--'):
conn.execute(text(command))
print("✅ files 테이블 수정 완료")
except Exception as e:
print(f"⚠️ files 테이블 수정 건너뜀: {e}")
# 커밋
conn.commit()
print("🎯 3단계: 더미 데이터 생성...")
# 더미 데이터 스크립트 실행
exec(open('scripts/03_insert_dummy_data.py').read())
print("\n🎉 전체 설정 완료!")
print("\n📋 다음 단계:")
print(" 1. API 서버 실행")
print(" 2. GET /jobs 엔드포인트 테스트")
print(" 3. Job 선택 후 BOM 파일 업로드")
return True
except Exception as e:
print(f"❌ 데이터베이스 설정 실패: {e}")
return False
if __name__ == "__main__":
setup_database()