With Liquibase, you can specify the database modification you desire using SQL or a number of other database-independent forms, such as XML, YAML, and JSON. It is incredibly simple for developers to submit updates to many database types by abstracting the database logic.
How does Liquibase work?
The changeLog file is how Liquibase functions most frequently. One or more changeSets are contained in this text file. A hierarchy of files is created when a changeLog contains further changeLogs.
A changeSet is the basic unit of change for a database. The change instruction itself and the related metadata are the two types of data that make up a changeSet. Although an instruction may contain one or more atomic changes (such as adding a table, changing a column, adding a constraint, inserting rows, etc.), when it is executed, it treats all of those changes as belonging to a single changeSet.
Liquibase is not a difference-based system
Liquibase uses the DATABASECHANGELOG table instead of a difference-based method because of a number of advantages. The most important aspect of database schema changes is their meaning. There are several techniques to change the database schema. Some of them could modify or modify related data. It allows for the specific procedure by which alterations are to be performed to be described.
Another aspect preventing Liquibase from being built on differences is performance. It is unable to compare data rapidly enough to make modifications because of large databases.
As Liquibase is a cross-platform application, it can be used with Linux, Windows, or Mac OS. Both the workstation and the server can use it.
It was created using Java. Java 1.6 or later is necessary for Liquibase’s most recent version (3.5.3).
JDBC driver is used to establish a connection to the database. For instance, the Oracle Database 126.96.36.199 JDBC Driver can be utilized with Oracle Database Express Edition 11g Release.
One of Liquibase’s numerous benefits is that it is compatible with a variety of database types. The compatible databases are listed in the following table.
- SQL Server
By utilizing extensions, Liquibase may support different database architectures.
Liquibase can be run in a number of different methods, such as an Apache Ant task or a direct Java call, but the command line is the method that is most frequently used because it allows for full Liquibase functionality.
ChangeLog file formats
ChangeLogs can be written in many different formats. Liquibase supports the following file formats.
- XML Format
- YAML Format
- JSON Format
- SQL Format
- Other Formats
The fact that the XML, YAML, and JSON formats enable all Liquibase functionalities is their main benefit. There are several restrictions associated with using the SQL format, such as the absence of automatic rollback generation.
Rollback in Liquibase
The ability to undo modifications is one of Liquibase’s most practical important features. This can be carried out automatically or with the aid of a predefined SQL script.
It is possible to use the automatically created rollback for commands like “CREATE TABLE,” “CREATE VIEW,” “ADD COLUMN,” and others. However, some changes, like “DROP TABLE,” cannot be reversed. In that situation, rollback must be manually defined.
Liquibase enables you to specify the desired database modification using SQL or a variety of other database-independent forms, such as XML, YAML, and JSON. To make it incredibly simple to publish updates to several database types, developers can abstract the database logic.
For more blogs visit: https://blog.knoldus.com/