Liquibase
Liquibase

What is Liquibase and how it works ?

Alex
2
3 minutes, 29 seconds Read
Www.Koverstory.com

Introduction

In this post we will discuss everything about Liquibase from initial to broad level.  After going through the below article you will in a position to understand Liquibase so come and let’s discuss about it –

If you are working on a project where you are frequently getting database update and you need to keep track of all the updates you do , also sometime you need to rollback the older version due to some reason, in that case you need to use a tool that keeps tracks of all these. Liquibase id one of the tools which can fulfill all these kind of requirement.

Liquibase is developed by Nathan Voxland. Liquibase is developed on java language. Liquibase is an open source tool which is used for database change management. Liquibase help us in tracking , managing and applying database changes. You can easily use with any database like- Oracle , MySQl, SQL Server , PosgresSQL or any other database.

Liquibase Supported languages
            Liquibase Supported languages

Using Liquibase you can define the chnages which you want to make in your database in xml or text, this approach is also called as declarative approach to database chnage management. Once you define your chnages in your xml or test then you can execute automatically or manually.

Benefits of using Liquibase

  1. Version Control : What ever the changes you do each time , Liquibase keeps track of all of then means at any point of time you can easily rollback you changes and deploy the previous version.
  2. Automatic Deployment: Liquibase can be used with your build pipeline so that you can automate you deployment of database on production or on any environment.
  3. Collaboration: Liquibase allows many developers to work on same database schema, without stepping on each other’s toe.
  4. Security : By default Liquibase provides encryptions of sensitive data like Account no., debit card no.
  5. Active Community : There are many resources who are working on Liquibase and supporting. Liquibase is very active project on GiT and supported by community.

Liquibase allows you to write your database changes in any of these four languages SQL,XML,YAML and JSON.

How Liquibase works Intetnally?

Basic Concept

Liquibase totally works on the master.xml files which contains all the changes to execute on database. This Master.xml file contains Changelogs and Changelogs consists of no. of changsets. A change set represents a single change for you database. Below is the sample xml which can be seen to understand-

How Liquibase works?
                                                                          Working of Liquibase

In above table we are just trying to create a table named – “Person” with single column -“name”.

Chnagelog

Changelog can be used for sequentially list all the changes you made on database. Using Changelog liquibase audits you changes and identifies the chnages which are not applied. A single piece of chnage in you chnagelog is known as Changeset. When you want to indroduce a new chnage jus add a changeset and mention the operations as chnage type.

Changeset

Chnageset is present inside Changelog. you store all the chnages which want to make on database in chnageset. Changeset contains id: and author: alos Path. Thease 3 attributes helps identify and store the logs.

Tracking Tables

DATABASESCHEMACHANGELOCK Table 

Liquibsae internally creates this table automatically if not exists in database. This tables make sure that only one instance of Liquibase runs at a time. When you make databse update then Liquibase reads from the  DATABASECHANGELOG table to check which chnagelog to run. below is the scructure of the table

DATABASECHANGELOG

Using DATABASESCHEMALOG table Liquibase tracks which changeset habeen run. Liquibase automatically creates this table if it does not exists. below is the colums of This table –

DATABASESCHEMALOG
DATABASESCHEMALOG Table

Database connections

You can use any of the following option to connect to database

  1. Connection profile
  2. Command line argument
  3. Environment Variables

Koverstory Feedback

It’s good opensource tool which can be used to track you all the database changes also it provides free facility for rollback. Some of the premium feature is paid but free features are more than sufficient to full all you database need.

To visit more articles please visit koverstory.com.

 

Similar Posts

2 Comments

  1. avatar
    Radiology & Nuclear Medicine ebooks says:

    Simply wish to say your article is as astonishing. The clearness in your post is simply great and i can assume you’re an expert on this subject. Well with your permission let me to grab your feed to keep up to date with forthcoming post. Thanks a million and please keep up the gratifying work.

Leave a Reply

Your email address will not be published. Required fields are marked *