Liquibase Course

Learn how to make database changes, manage various code versions and update different environments with Liquibase

Last updated 2022-01-10 | 4.1

- define a database structure using Liquibase in XML format
- upgrade and rollback database structure
- integrate Liquibase with Spring Boot for automatic database creation and upgrade on application startup

What you'll learn

define a database structure using Liquibase in XML format
upgrade and rollback database structure
integrate Liquibase with Spring Boot for automatic database creation and upgrade on application startup
use Liquibase for testing database upgrades and rollbacks
generate SQL upgrade and rollback scripts

* Requirements

* Understand basics of relational databases
* Be able to write SQL statements that create tables
* indexes etc.
* Be able to pull source code from a Git repository
* Be able to write Java code and use Spring Boot
* Have IDE that allows creating Java web applications (e.g. IntelliJ IDEA
* Eclipse)

Description

Do you want to stop frustration caused by manual database updates? Do you know that there is a free tool to help you out? If your answer is YES, it means that you might benefit from this course.


I start from the very beginning of using Liquibase. You should have some database and SQL knowledge. Basics of Java will increase your final satisfaction as I will also show you Liquibase integration with Spring Boot. I believe in practice so there will be mostly coding with some necessary theory. You will have many chances to try using Liquibase yourself because I included some exercises for you as well.


Get ready for an exiting journey to through Liquibase functionalities.

Who this course is for:

  • Java developers who want to make development and delivery of the database easy

Course content

8 sections • 38 lectures

Who I am Preview 03:24

This is an introduction of me as an instructor. You will hear about my past experience and you will understand why I am a good person to talk about database versioning.

What you will learn Preview 00:46

I present a high level plan of the course. You will know which subjects we will be talking about and practicing.

Technology Preview 02:19

You will get a basic overview of technology that we will use during the course.

What we will build Preview 00:47

I will tell you what is the application that we will be working on during the course.

Plan Preview 00:50

I reveal the plan for this section.

Architecture and software overview Preview 02:27

I talk more about the sample application architecture and functionality. It will be easier for you to modify the code later.

Prerequisites Preview 03:11

I talk about not obvious but necessary software that you must have to complete exercises for this course.

If you do not have Git, Java and MySQL installed and configured on your computer yet, you should have it after this lecture.

Commands used during this lecture

  • git --version
    It prints the current version of Git. It does not have to be a specific version but Git must be installed and the command should work.

Run the application Preview 09:08

I show how to get the application source code from the Git repository, how to configure it and how to run it. After this lecture you should be able to do the same and have the dating platform for dogs configured and working on your computer.

Task to modify the database structure Preview 01:03

I define new feature requirement that involves updating the database structure. You will understand why we have to modify the database.

Concept Preview 04:29

You will understand the difference between deployment of new application version and new database structure and why it requires different solutions. I will present you the database versioning concept that Liquibase follows.

Installing Liquibase and database driver Preview 04:07

You will be able to download, install and configure Liquibase and MySQL JDBC driver. After this lecture you should repeat my steps to have Liquibase ready on your computer.

Db structure definition in Liquibase changesets Preview 14:47

You will be able to define a basic database structure in Liquibase XML format. You will learn changeset syntax and some change types: table creation with columns, a primary key, autoincrement, not nullable constraints.

Upgrading database Preview 07:05

You will get a chance to upgrade a database using update Liquibase command. You will also see a sample error during execution and a solution to it.

Data changes and incremental database upgrade Preview 05:54

You will learn how to make data changes using Liquibase changesets.

How does incremental upgrade work? Preview 02:17

You will understand Liquibase internals - how Liquibase knows which changesets have to be applied on a database.

Practice Preview 01:26

I will define a task for you to practice changeset creation. You will be able to practice your knowledge.

Database versioning basics

Development database challenge Preview 02:41

You will understand special needs of development database in software companies and why a single one shared with many developers is not a good solution.

In-memory H2 database Preview 03:16

I will show you how to add H2 database to the project, integrate it with Spring Boot and use it instead of MySQL database.

Liquibase integration with Spring Boot Preview 02:56

We will add Liquibase to the project to be configured by Spring Boot. You will learn how to use it to upgrade H2 database during each application start.

Sample data Preview 06:23

You will learn how to add various types of data through a changeset: text, numbers and use subqueries in insert Liquibase changes. You will be able to split changesets across multiple files and nest one file in the other.

Rolling back changes challenge Preview 00:49

You will know why having a possibility of rolling back a database structure change is important.

Autorollback Preview 06:16

You will be able to revert changes from the database taking advantage of autorollback feature of Liquibase.

Custom rollback Preview 04:03

What to do if autorollback does not work? You will learn how to create a custom rollback for a changeset.

Autorollback support

Production challenge Preview 01:13

You will realize that the production environment often have its own requirements and you cannot avoid SQL scripts.

Tag, upgrade and rollback commands Preview 07:01

You learn how to apply a tag on the database and how to roll back to that tag. You will also see how to rollback to a specific timestamp.

Generate upgrade, rollback SQL scripts Preview 06:36

You will learn how to prepare upgrade and rollback SQL scripts for a database when you cannot use Liquibase XML changesets directly.

Testing upgrade and rollback Preview 03:17

You get familiar with a fast and automatic way of testing changesets for update and rollback procedures.

Liquibase commands

Introduction Preview 00:53

I will tell you when to look for information about Liquibase.

Changeset hash Preview 08:29

I will explain you why you should create new changesets instead of modifying existing ones. I will show you how Liquibase checks this rule using a hash. And in the mean time you will also learn a new command - dropAll.

One change per changeset Preview 00:59

You will understand why you should never mix more than one change per changeset.

Best practices

Introduction Preview 00:29

I will invite you to a series of exercises to practice using Liquibase.

Exercise 1 Preview 01:52

You will practice Liquibase commands.

Exercise 2 Preview 06:08

You will practice creating various types of changes while preserving existing data and securing rollback possibility for the future.

Exercise 3 Preview 04:07

You will practice creating custom not obvious rollbacks.