This tutorial builds on the setup that is described in the Quick Start.
In the liquibase project folder that you created, create a
sql folder. This is the folder in which you will place SQL scripts that Liquibase will track, version, and deploy.
This is a one-time step to configure a change log to point to the
sql folder that will contain SQL scripts. Create and save a file in the liquibase project directory you created. The file should be named
myChangeLog.xml. The contents of
myChangeLog.xml should be as follows:
liquibase.properties file from the tutorial setup and the newly created
myChangeLog.xml, we are now ready to start adding SQL scripts to the
sql folder. Liquibase will order the scripts in the folder alphanumerically. Create a file named
001_create_person_table.sql with the following and save it in the
We are now ready to deploy our first script! Open a terminal and run
LB_HOME/liquibase update if on a UNIX system or
LB_HOME\liquibase.bat update if on Windows.
You will see that your database now contains a table called “PERSON”. To inpsect the H2 database that is a part of the tutorial, open a terminal, navigate to the LB_HOME folder where you extracted the Liquibase
*.zip or the
*.tar.gz to and then to the lib subdirectory where the h2 driver jar is located. Run
java -jar h2-1.4.199.jar.Note: enter the specific version of the h2*.jar that you downloaded! Enter the JDBC URL, User Name, and Password from the
liquibase.properties file you created per the tutorial setup. You will notice two other tables are created as well: “databasechangelog” and “databasechangeloglock”. The databasechangelog table contains a list of all the changes that have been run against the database. The databasechangeloglock table is used to make sure two machines don’t attempt to modify the database at the same time.