[STK1-01] 공통 기반 + DB 스키마

작업 내용 (설계 의도)

변경 사항

  • 모노레포 골격과 Spring Boot 설정을 세운다.
  • common 패키지: Clock·CORS·ExceptionHandler 설정.
  • Flyway 마이그레이션으로 price_alert·alert_history·watchlist·stock 테이블을 생성한다.
  • 이후 모든 티켓이 의존하는 선행 병목 티켓.

의존

  • 선행: 없음
  • 후행: STK1-02, STK1-03, STK1-07

롤백

  • 마이그레이션 실패 시 역방향 DDL로 테이블 제거.

다이어그램

처리 흐름

sequenceDiagram
    participant App as SpringApplication
    participant Fly as Flyway
    participant DB as MySQL 3308

    App->>Fly: 시작 시 자동 실행
    Fly->>DB: V1__init.sql 적용
    Note over DB: price_alert, alert_history,<br/>watchlist, stock 생성
    DB-->>Fly: 성공
    Fly-->>App: 마이그레이션 완료

클래스 의존

flowchart LR
    subgraph common["common 패키지"]
        Clock
        ExceptionHandler
        CorsConfig
    end
    subgraph migration["Flyway"]
        V1[V1__init.sql]
    end
    subgraph tables["DB Tables"]
        PA[price_alert]
        AH[alert_history]
        WL[watchlist]
        ST[stock]
    end
    V1 --> PA
    V1 --> AH
    V1 --> WL
    V1 --> ST

테스트 케이스

  • 빈 DB에서 마이그레이션이 오류 없이 순서대로 적용된다.
  • 이미 적용된 스크립트를 재실행해도 Flyway 체크섬 오류 없이 멱등하게 통과한다.
  • watchlist.symbol 유니크 제약이 생성되어 중복 삽입 시 DB 에러가 발생한다.
  • price_alert.idx_status 인덱스가 존재하여 상태 기반 조회 플랜에 인덱스가 사용된다.