What is Liquibase?
Liquibase is a popular open source database schema management tool. The tool uses the concept of change sets to manage the evolution of a database schema. The change sets can be specified in XML, JSON, YAML, or SQL files and contain the sequence of changes that are required to transform a database schema from one state to another. Liquibase keeps track of the changes in its own metadata tables in the database to determine which migration steps were already performed and which steps still need to be executed.
Liquibase supports different databases either
built-in or via extensions.
What's new?
The existing extensions for SAP HANA were outdated and were missing features. A
new extension has been released that adds more complete support for SAP HANA to Liquibase.
The extension adds SAP HANA implementations of the Liquibase data types and standard changes. In addition, it adds a custom change for changing the type of a table from column store to row store and vice versa.
How can I get started?
To get started you can follow the Liquibase
Quick Start documentation.
The Liquibase quick start guide uses the H2 database. To run the tutorial on SAP HANA you need to follow some additional steps and make some adjustments during the tutorial setup:
Get SAP HANA
If you don't have an SAP HANA instance yet, you can get a free copy of SAP HANA, express edition.
There are several options to
run HANA:
Get the SAP HANA JDBC driver
The SAP HANA JDBC driver is available on Maven Central:
<dependency>
<groupId>com.sap.cloud.db.jdbc</groupId>
<artifactId>ngdbc</artifactId>
<version>2.4.64</version>
</dependency>
To use it in the quick start, download the
JAR file and copy it into the
lib folder.
Get the SAP HANA Liquibase extension
The SAP HANA Liquibase extension is also available on Maven Central:
<dependency>
<groupId>com.sap.foss.hana</groupId>
<artifactId>liquibase-hana</artifactId>
<version>1.0.0</version>
</dependency>
It's an open source extension, and as such the source code is also available on
Github.
To use it in the quick start, download the
JAR file and copy it into the
lib folder.
Adjust the configuration
The
liquibase.properties file in the quick start project must be adapted for SAP HANA:
driver: com.sap.db.jdbc.Driver
classpath: ./ngdbc-2.4.64.jar
url: jdbc:sap://hxehost:39015/
username: SYSTEM
password: HXEHana1
changeLogFile: myChangeLog.xml
Make sure to change the
host,
port,
username, and
password properties to match your database.
Complete the tutorial
With these changes in place you can now complete the tutorial and run some changes against your SAP HANA database.
Happy coding!