Skip to content

Commit e6aae10

Browse files
authored
[chore] Flyway 적용하여 DB 마이그레이션 관리하기
1 parent dedaba7 commit e6aae10

2 files changed

Lines changed: 35 additions & 28 deletions

File tree

backend/build.gradle.kts

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ dependencies {
8686
implementation("net.javacrumbs.shedlock:shedlock-spring:5.10.0")
8787
implementation("net.javacrumbs.shedlock:shedlock-provider-redis-spring:5.10.0")
8888

89+
// flyway
90+
implementation("org.flywaydb:flyway-core")
91+
implementation("org.flywaydb:flyway-database-postgresql")
8992
}
9093

9194
tasks.withType<Test> {
@@ -108,9 +111,9 @@ checkstyle {
108111
toolVersion = "10.12.5" // 최신 안정 버전으로 업그레이드
109112
configFile = rootProject.file("config/checkstyle/naver-checkstyle-rules.xml")
110113
configProperties = mapOf(
111-
"suppressionFile" to rootProject
112-
.file("config/checkstyle/naver-checkstyle-suppressions.xml")
113-
.absolutePath
114+
"suppressionFile" to rootProject
115+
.file("config/checkstyle/naver-checkstyle-suppressions.xml")
116+
.absolutePath
114117
)
115118
isIgnoreFailures = false // 명시적으로 설정
116119
}
@@ -125,20 +128,20 @@ jacoco {
125128

126129
/** 공통 커버리지 제외 패턴 */
127130
val coverageExcludes = listOf(
128-
"**/*Application*",
129-
"**/config/**",
130-
"**/dto/**",
131-
"**/exception/**",
132-
"**/response/**",
133-
"**/repository/**",
134-
"**/init/**",
135-
"**/error/**",
136-
"**/entity/**",
137-
"**/home/**",
138-
"**/vo/**",
139-
"**/Q*.*",
140-
"**/controller/**/*Api.class",
141-
"**/controller/**/*Api\$*"
131+
"**/*Application*",
132+
"**/config/**",
133+
"**/dto/**",
134+
"**/exception/**",
135+
"**/response/**",
136+
"**/repository/**",
137+
"**/init/**",
138+
"**/error/**",
139+
"**/entity/**",
140+
"**/home/**",
141+
"**/vo/**",
142+
"**/Q*.*",
143+
"**/controller/**/*Api.class",
144+
"**/controller/**/*Api\$*"
142145
)
143146

144147
/** -----------------------------
@@ -179,7 +182,7 @@ tasks.withType<Test>().configureEach {
179182
override fun afterSuite(suite: TestDescriptor, result: TestResult) {
180183
if (suite.parent == null) {
181184
println(
182-
"""
185+
"""
183186
------------------------
184187
✅ TEST RESULT SUMMARY
185188
Total tests : ${result.testCount}
@@ -247,11 +250,11 @@ tasks.register<JacocoReport>("jacocoFullTestReport") {
247250
val main = sourceSets.named("main").get()
248251
sourceDirectories.setFrom(main.allSource.srcDirs)
249252
classDirectories.setFrom(
250-
files(
251-
main.output.classesDirs.files.map {
252-
fileTree(it) { exclude(coverageExcludes) }
253-
}
254-
)
253+
files(
254+
main.output.classesDirs.files.map {
255+
fileTree(it) { exclude(coverageExcludes) }
256+
}
257+
)
255258
)
256259
}
257260

@@ -289,11 +292,11 @@ tasks.jacocoTestReport {
289292
html.outputLocation.set(layout.buildDirectory.dir("reports/jacoco/html"))
290293
}
291294
classDirectories.setFrom(
292-
files(
293-
classDirectories.files.map {
294-
fileTree(it) { exclude(coverageExcludes) }
295-
}
296-
)
295+
files(
296+
classDirectories.files.map {
297+
fileTree(it) { exclude(coverageExcludes) }
298+
}
299+
)
297300
)
298301
}
299302

backend/src/main/resources/application.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ spring:
3030
host: localhost
3131
port: 6379
3232
password: ${REDIS_PASSWORD:}
33+
flyway:
34+
enabled: true
35+
baseline-on-migrate: true
36+
baseline-version: 1
3337

3438
server:
3539
tomcat:

0 commit comments

Comments
 (0)