|
27 | 27 | import liquibase.exception.LiquibaseException;
|
28 | 28 | import liquibase.integration.spring.SpringLiquibase;
|
29 | 29 | import liquibase.integration.spring.SpringResourceAccessor;
|
| 30 | +import lombok.extern.slf4j.Slf4j; |
30 | 31 | import org.springframework.boot.SpringApplication;
|
31 | 32 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
32 | 33 | import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
|
|
40 | 41 | /**
|
41 | 42 | * Provides ability to run Spring Boot application to only validate Liquibase migrations.
|
42 | 43 | */
|
| 44 | +@Slf4j |
43 | 45 | public final class LiquibaseSupport {
|
44 | 46 |
|
45 | 47 | private LiquibaseSupport() {
|
@@ -104,8 +106,17 @@ private static void performLiquibaseValidate(SpringLiquibase springLiquibase)
|
104 | 106 | // NOTE: spring.liquibase.labels aren't supported as we don't use them
|
105 | 107 | private static void validate(Liquibase liquibase, SpringLiquibase springLiquibase)
|
106 | 108 | 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 | + } |
109 | 120 | }
|
110 | 121 |
|
111 | 122 | // CheckStyle: ignore LineLength for next 2 lines
|
|
0 commit comments