项目作者: satyendrakumarsingh

项目描述 :
Spring Boot Liquibase Integration with H2DB(In Memory Database)
高级语言: Java
项目地址: git://github.com/satyendrakumarsingh/spring-boot-liquibase-h2db.git
创建时间: 2019-07-30T04:59:58Z
项目社区:https://github.com/satyendrakumarsingh/spring-boot-liquibase-h2db

开源协议:Eclipse Public License 2.0

下载


Need and use of Liquibase?

We are using version control tool for Java and other languages to manage, track and apply changes whenever required.
Liquibase is an open source tool for database version control.
Using Liquibase we can manage, tack and apply changes in DB using simple human readable changelog files.

Spring Boot 2 Liquibase Integration

In this sample application H2(In Memory Database) is used to show simple integration of Liquibase using change log files.

We can use different small change log files to manage our DB changes .
In this example we have one master changeloge file (changelog-master.xml)

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <databaseChangeLog
  3. xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
  6. xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
  7. http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
  8. <include file="/db/changelog/changes/create-application-information-table-changelog.xml"></include>
  9. <include file="/db/changelog/changes/insert-application-information-table-changelog.xml"></include>
  10. <include file="/db/changelog/changes/update-application-information-table-changelog.xml"></include>
  11. </databaseChangeLog>

And we have different sub change log files -

  • create-application-information-table-changelog.xml
  • insert-application-information-table-changelog.xml
  • update-application-information-table-changelog.xml

All above sub change log files are imported in master file -

  1. <include file="/db/changelog/changes/create-application-information-table-changelog.xml"></include>
  2. <include file="/db/changelog/changes/insert-application-information-table-changelog.xml"></include>
  3. <include file="/db/changelog/changes/update-application-information-table-changelog.xml"></include>

Above sub change file will create table in database, insert data in table and update records of the table when you run the application.
You can specify order of the excution of each changes in change log file.

Read More - https://www.liquibase.org/
*