Added liquibase autoconfiguration for database migrations

If Liquibase is on the classpath it will fire up on startup. Various
config options are available (as well as the option to disable it).
Liquibase uses a YAML format for changes (in classpath:db/changelog).
This commit is contained in:
Marcel Overdijk
2014-04-17 23:59:36 +02:00
committed by Dave Syer
parent ed64640ea4
commit 68e33b25c1
22 changed files with 611 additions and 2 deletions

View File

@@ -158,6 +158,13 @@ content into your application; rather pick only the properties that you need.
spring.jpa.hibernate.naming-strategy= # naming classname
spring.jpa.hibernate.ddl-auto= # defaults to create-drop for embedded dbs
# LIQUIBASE ({sc-spring-boot-autoconfigure}/liquibase/LiquibaseProperties.{sc-ext}[LiquibaseProperties])
spring.liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml
spring.liquibase.contexts= # runtime contexts to use
spring.liquibase.default-schema= # default database schema to use
spring.liquibase.drop-first=false
spring.liquibase.should-run=true
# JMX
spring.jmx.enabled=true # Expose MBeans from Spring
@@ -170,7 +177,6 @@ content into your application; rather pick only the properties that you need.
spring.rabbitmq.virtualhost=
spring.rabbitmq.dynamic=
# REDIS ({sc-spring-boot-autoconfigure}/redis/RedisProperties.{sc-ext}[RedisProperties])
spring.redis.host=localhost # server host
spring.redis.password= # server password

View File

@@ -56,6 +56,9 @@ The following auto-configuration classes are from the `spring-boot-autoconfigure
|{sc-spring-boot-autoconfigure}/data/JpaRepositoriesAutoConfiguration.{sc-ext}[JpaRepositoriesAutoConfiguration]
|{dc-spring-boot-autoconfigure}/data/JpaRepositoriesAutoConfiguration.{dc-ext}[javadoc]
|{sc-spring-boot-autoconfigure}/liquibase/LiquibaseAutoConfiguration.{sc-ext}[LiquibaseAutoConfiguration]
|{dc-spring-boot-autoconfigure}/liquibase/LiquibaseAutoConfiguration.{dc-ext}[javadoc]
|{sc-spring-boot-autoconfigure}/MessageSourceAutoConfiguration.{sc-ext}[MessageSourceAutoConfiguration]
|{dc-spring-boot-autoconfigure}/MessageSourceAutoConfiguration.{dc-ext}[javadoc]

View File

@@ -1097,6 +1097,21 @@ independence: usually only one or at most couple of platforms is needed.
[[howto-execute-liquibase-database-migrations-on-startup]]
==== Execute Liquibase database migrations on startup
To automatically run Liquibase database migrations on startup, add the
`spring-boot-starter-liquibase` to your classpath.
The master change log is by default read from `db/changelog/db.changelog-master.yaml` but
can be set using `spring.liquibase.change-log`. See
{sc-spring-boot-autoconfigure}/liquibase/LiquibaseProperties.{sc-ext}[`LiquibaseProperties`]
for details of available settings like contexts, default schema etc.
There is a {github-code}/spring-boot-samples/spring-boot-sample-liquibase[Liquibase sample] so
you can see how to set things up.
[[howto-batch-applications]]
== Batch applications

View File

@@ -1,5 +1,5 @@
= Spring Boot Reference Guide
Phillip Webb; Dave Syer; Josh Long; Stéphane Nicoll; Rob Winch; Andy Wilkinson;
Phillip Webb; Dave Syer; Josh Long; Stéphane Nicoll; Rob Winch; Andy Wilkinson; Marcel Overdijk;
:doctype: book
:toc:
:toclevels: 4

View File

@@ -238,6 +238,9 @@ and Hibernate.
|`spring-boot-starter-jdbc`
|JDBC Database support.
|`spring-boot-starter-liquibase`
|Support for Liquibase database migrations.
|`spring-boot-starter-mobile`
|Support for `spring-mobile`