|
|
|
|
@ -29,18 +29,13 @@ dependencies {
|
|
|
|
|
|
|
|
|
|
liquibaseRuntime("org.liquibase:liquibase-core") |
|
|
|
|
liquibaseRuntime("org.liquibase.ext:liquibase-hibernate6:4.25.1") |
|
|
|
|
liquibaseRuntime("info.picocli:picocli:4.6.3") |
|
|
|
|
liquibaseRuntime("com.h2database:h2") |
|
|
|
|
liquibaseRuntime("org.postgresql:postgresql") |
|
|
|
|
|
|
|
|
|
testImplementation("org.springframework.boot:spring-boot-starter-test") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
liquibase { |
|
|
|
|
activities.register("postgres") { |
|
|
|
|
this.arguments = mapOf("changeLogFile" to "src/main/resources/postgres/dev.yaml") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
tasks.withType<KotlinCompile> { |
|
|
|
|
kotlinOptions { |
|
|
|
|
freeCompilerArgs += "-Xjsr305=strict" |
|
|
|
|
@ -51,3 +46,46 @@ tasks.withType<KotlinCompile> {
|
|
|
|
|
tasks.withType<Test> { |
|
|
|
|
useJUnitPlatform() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
liquibase { |
|
|
|
|
val profile = System.getProperty("profile") ?: "local" |
|
|
|
|
|
|
|
|
|
// TODO: db.yaml objectMapper 로 읽어서 세팅? |
|
|
|
|
activities.register("local") { |
|
|
|
|
this.arguments = mapOf( |
|
|
|
|
"url" to "jdbc:postgresql://localhost:15432/localdb", |
|
|
|
|
"username" to "flower", |
|
|
|
|
"password" to "flower" |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
activities.register("dev") { |
|
|
|
|
this.arguments = mapOf( |
|
|
|
|
"url" to "jdbc:postgresql://flower-fragrance-stage.cluster-cbth1bnhfbdg.ap-northeast-2.rds.amazonaws.com:5432/devdb", |
|
|
|
|
"username" to "anypoint", |
|
|
|
|
"password" to "*emflaj*" |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
runList = profile |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun addArguments(name: String, args: Map<String, String>) { |
|
|
|
|
val activity = liquibase.activities.getByName(name) |
|
|
|
|
activity.name = name |
|
|
|
|
val activityArgs = activity.arguments as Map<*, *> |
|
|
|
|
val newArgs = mutableMapOf<String, String>() |
|
|
|
|
newArgs.putAll(activityArgs.map { it.key as String to it.value as String }) |
|
|
|
|
newArgs.putAll(args) |
|
|
|
|
|
|
|
|
|
newArgs.forEach { |
|
|
|
|
println("arguments[\"${it.key}\"]=\"${it.value}\"") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
activity.arguments = newArgs |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
tasks.getByName("generateChangelog").doFirst { |
|
|
|
|
val changeLogFile = "src/main/resources/liquibase/postgres/changelog/generated.yaml" |
|
|
|
|
delete(changeLogFile) |
|
|
|
|
val name = System.getProperty("name") ?: "local" |
|
|
|
|
addArguments(name, mapOf("changeLogFile" to changeLogFile)) |
|
|
|
|
} |
|
|
|
|
|