liquibase-incubator with feature examples for http://www.liquibase.org/
A project with demo of liquibase capabilities with spring framework based on http://www.liquibase.org/documentation/spring.html
H2 database is used in demo org.liquibase.samples
because of ease of use
Jacoco
/cobertura
code coverage, pmd
, checkstyle
, enforcer
, findbugs
Project structure is simple. Basically, it is a maven project:
- Samples under
src/test/java/org.liquibase.samples
Resources
- DB scripts with test tables and data
src/main/resources/liquibase
undergroovy
/xml
packages - Spring application contexts used in the
org.liquibase.samples
undersrc/main/resources/liquibase
- Liquibase properties under
src/main/resources/liquibase
used by changeloggroovy/datasetChangeLog.groovy
andxml/datasetChangeLog.xml
additional changelog filedb.changelog-included.xml
- Logging done via liquibase logging extensions via slf4j using Log4j configuration under
src/main/resources/log4j.xml
andsrc/test/resources/log4j.xml
Based onhttps://liquibase.jira.com/wiki/spaces/CONTRIB/pages/38797319/SLF4J+Logging+Extension
site with liquibase extensions
Libraries:
- liquibase
- liquibase groovy dsl
- liquibase slf4j extension
- groovy (for dsl)
- spring framework
- spring jdbc for spring jdbc migrations
- commons-dbcp2 for database connection pool (other pools can be used as well)
- h2 file based database for ease of db usage
- log4j logging (possibility to configure) via slf4j extension of liquibase
mvn clean package
XmlDslLiquibaseSpringTest
based on xml implementation as default and declarative.GroovyDslLiquibaseSpringTest
based on groovy dsl implementation with power to include groovy code No parameters required. Just run the main method in the class
Note: Comments in the files and logging should be sufficient to play with org.liquibase.samples
to see results and experiment with sql migrations`
- Liquibase maven plugin usage
mvn liquibase:update
to run migrationsmvn liquibase:generateChangeLog
to generate migration file based on existing db
- XML based example with xml power and Groovy DSL example with groovy power
- SpringLiquibase class integration to spring
- Configuration of parameters in datasetChangelog files via properties
- Pure sql and database independent migrations
- Usage of contexts to be executed on specific environments
- Usage of preconditions to make checks before migration execution
- Usage of including other change set files into configuration
- Usage of runOnChange runInTransaction for particular change
- Usage of tags
- Usage of default rollback & rollback file generation
- Meta tables
databasechangelog
anddatabasechangeloglock
creation - Log4j integration via slf4j extension of liquibase
- Try extensions/integrations from https://liquibase.jira.com/wiki/spaces/CONTRIB/overview