Skip to content

Commit b0ac8c0

Browse files
committed
chore: log more messages during validation process
Part of #383
1 parent b2f6a05 commit b0ac8c0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Diff for: src/main/java/ru/mystamps/web/support/liquibase/LiquibaseSupport.java

+13-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import liquibase.exception.LiquibaseException;
2828
import liquibase.integration.spring.SpringLiquibase;
2929
import liquibase.integration.spring.SpringResourceAccessor;
30+
import lombok.extern.slf4j.Slf4j;
3031
import org.springframework.boot.SpringApplication;
3132
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
3233
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
@@ -40,6 +41,7 @@
4041
/**
4142
* Provides ability to run Spring Boot application to only validate Liquibase migrations.
4243
*/
44+
@Slf4j
4345
public final class LiquibaseSupport {
4446

4547
private LiquibaseSupport() {
@@ -104,8 +106,17 @@ private static void performLiquibaseValidate(SpringLiquibase springLiquibase)
104106
// NOTE: spring.liquibase.labels aren't supported as we don't use them
105107
private static void validate(Liquibase liquibase, SpringLiquibase springLiquibase)
106108
throws LiquibaseException {
107-
DatabaseChangeLog changeLog = liquibase.getDatabaseChangeLog();
108-
changeLog.validate(liquibase.getDatabase(), springLiquibase.getContexts());
109+
110+
log.info("Validating the migrations");
111+
try {
112+
DatabaseChangeLog changeLog = liquibase.getDatabaseChangeLog();
113+
changeLog.validate(liquibase.getDatabase(), springLiquibase.getContexts());
114+
log.info("Migrations are valid");
115+
116+
} catch (LiquibaseException ex) {
117+
log.error("Failed to validate migrations", ex);
118+
throw ex;
119+
}
109120
}
110121

111122
// CheckStyle: ignore LineLength for next 2 lines

0 commit comments

Comments
 (0)