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 인덱스가 존재하여 상태 기반 조회 플랜에 인덱스가 사용된다.