Commit 83384d9b by Johannes Edmeier

Revisit liquibase and flyway legacy conversion

parent 393d3da5
...@@ -208,11 +208,14 @@ public class LegacyEndpointConverters { ...@@ -208,11 +208,14 @@ public class LegacyEndpointConverters {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static Map<String, Object> convertLiquibase(List<Map<String, Object>> reports) { private static Map<String, Object> convertLiquibase(List<Map<String, Object>> reports) {
return reports.stream() Map<String, Object> liquibaseBeans = reports.stream()
.sequential() .sequential()
.collect(toMap(r -> (String) r.get("name"), r -> singletonMap("changeSets", .collect(toMap(r -> (String) r.get("name"),
r -> singletonMap("changeSets",
LegacyEndpointConverters.convertLiquibaseChangesets( LegacyEndpointConverters.convertLiquibaseChangesets(
(List<Map<String, Object>>) r.get("changeLogs"))))); (List<Map<String, Object>>) r.get("changeLogs")))));
return singletonMap("contexts", singletonMap("application", singletonMap("liquibaseBeans", liquibaseBeans)));
} }
private static List<Map<String, Object>> convertLiquibaseChangesets(List<Map<String, Object>> changeSets) { private static List<Map<String, Object>> convertLiquibaseChangesets(List<Map<String, Object>> changeSets) {
...@@ -243,11 +246,13 @@ public class LegacyEndpointConverters { ...@@ -243,11 +246,13 @@ public class LegacyEndpointConverters {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static Map<String, Object> convertFlyway(List<Map<String, Object>> reports) { private static Map<String, Object> convertFlyway(List<Map<String, Object>> reports) {
return reports.stream() Map<String, Object> flywayBeans = reports.stream()
.sequential() .sequential()
.collect(toMap(r -> (String) r.get("name"), r -> singletonMap("migrations", .collect(toMap(r -> (String) r.get("name"),
r -> singletonMap("migrations",
LegacyEndpointConverters.convertFlywayMigrations( LegacyEndpointConverters.convertFlywayMigrations(
(List<Map<String, Object>>) r.get("migrations"))))); (List<Map<String, Object>>) r.get("migrations")))));
return singletonMap("contexts", singletonMap("application", singletonMap("flywayBeans", flywayBeans)));
} }
private static List<Map<String, Object>> convertFlywayMigrations(List<Map<String, Object>> migrations) { private static List<Map<String, Object>> convertFlywayMigrations(List<Map<String, Object>> migrations) {
......
{ {
"contexts": {
"application": {
"flywayBeans": {
"flyway": { "flyway": {
"migrations": [ "migrations": [
{ {
...@@ -27,4 +30,7 @@ ...@@ -27,4 +30,7 @@
} }
] ]
} }
}
}
}
} }
{ {
"contexts": {
"application": {
"liquibaseBeans": {
"liquibase": { "liquibase": {
"changeSets": [ "changeSets": [
{ {
...@@ -58,4 +61,7 @@ ...@@ -58,4 +61,7 @@
} }
] ]
} }
}
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment