Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ dependencies {

runtimeOnly 'com.mysql:mysql-connector-j'

// Flyway - DB 마이그레이션 관리
implementation 'org.flywaydb:flyway-mysql'

// 테스트용 H2 데이터베이스
testRuntimeOnly 'com.h2database:h2'

Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@ spring:
username: ${DB_USERNAME:root}
password: ${DB_PASSWORD:root}

# 로컬 Flyway 설정 (기존 DB baseline 처리)
flyway:
baseline-on-migrate: true # 기존 스키마가 있는 DB는 V1을 baseline으로 건너뜀
baseline-version: 1

# 로컬 JPA 설정
jpa:
hibernate:
ddl-auto: update # 로컬에서는 자동 스키마 업데이트
show-sql: true # SQL 로그 출력
ddl-auto: validate # Flyway가 스키마 관리, Hibernate는 검증만
show-sql: true
properties:
hibernate:
format_sql: true # SQL 포맷팅
format_sql: true

# 메일 디버그 설정
mail:
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ spring:
idle-timeout: 600000
max-lifetime: 1800000

# 프로덕션 Flyway 설정 (기존 DB baseline 처리)
flyway:
baseline-on-migrate: true # 기존 스키마가 있는 DB는 V1을 baseline으로 건너뜀
baseline-version: 1

# 프로덕션 JPA 설정
jpa:
hibernate:
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ spring:
enabled: true
path: /h2-console

# 테스트 Flyway 비활성화 (H2 + create-drop으로 Hibernate가 직접 관리)
flyway:
enabled: false

# 테스트용 JPA 설정
jpa:
hibernate:
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ spring:
profiles:
default: local

# Flyway 공통 설정
flyway:
locations: classpath:db/migration

# JPA 공통 설정
jpa:
properties:
Expand Down
Loading