Liquibase Command init project

Liquibase provides init project command to start with Liquibase, it will create a new project with minimum input and all the basic files and configuration required to execute Liquibase.

liquibase init project

init project will ask for basic information, either provide specific or use the default.

if required, all the parameters can be passed in CLI at the time of project creation as well.

liquibase init project --project-dir=./ --changelog-file=example-changelog.sql --format=sql --project-defaults-file=liquibase.properties --url=jdbc:h2:tcp://localhost:9090/mem:dev --username=root --password=rootroot

once done it will create a Liquibase.properties file with a basic H2 database script. the Liquibase.properties file contains properties that are required to execute Liquibase script. those properties can be passed in CLI as well as in environment variables.

liquibase.properties

changeLogFile=example-changelog.sql
liquibase.command.url=jdbc:h2:tcp://localhost:9090/mem:dev
liquibase.command.username: root
liquibase.command.password: rootroot
liquibase.command.referenceUrl: jdbc:h2:tcp://localhost:9090/mem:integration
liquibase.command.referenceUsername: dbuser
liquibase.command.referencePassword: letmein

Execute liquibse update command, it will execute the default ChangeLog file provided and update the database.
Learn more about how to start the H2 database console

follow us on