It is an open source library used to track, manage and implement database changes.
Open source
The database is independent
Flexible (changes can be applied now or later)
Easy to read, easy to follow
Can be loaded into the versioning system
All database changes can be viewed in one place
Changes from multiple developers can be combined
Automatically detects entity changes and generates change-log file
Change log file supports multiple formats (yaml, json, xml, sql)
Differences between two databases can be taken
Undo changes (rollback)
Liquibase keeps track of history (databasechangelog table)
mvn clean compile liquibase:diff -Dliquibase.url=jdbc:postgresql://localhost:5432/spring-boot-liquibase -Dliquibase.referenceUrl=hibernate:spring:io.perasoft?dialect=org.hibernate.dialect.PostgreSQLDialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
mvn clean compile liquibase:update -Dliquibase.url=jdbc:postgresql://localhost:5432/spring-boot-liquibase
mvn clean compile liquibase:rollback -Dliquibase.url=jdbc:postgresql://localhost:5432/spring-boot-liquibase -Dliquibase.rollbackCount=1
NOTE: rollback command does not work for sql files
To find out what the instruction set does
To see the history record (databasechangelog table)
To see if there is a lock on the databasechangeloglock table
Release locks on databasechangeloglock table
mvn liquibase:releaseLocks