Liquibase: example of automated roll changes on the relational database

Instead of a Preface


the Article will be interesting for those who have ever thought about the issue of rolling forward the changes (patch) to the relational database. The article will not be interesting to those who have already mastered and uses Liquibase. The main purpose of this article is the reference to the repository use case. As an example I chose rolling sample schema HR Oracle database (list of all supported databases) — anyone can download the repository and to play at home. The desire to demonstrate an example caused by the discussion at the resource sql.ru.


What Liquibase


What Liquibase can be found on official website of the product. I want to mention a couple of good articles on this resource:
Manage database migrations with Liquibase
Using Liquibase without a headache. 10 tips from my experience of developing real


Why I use Liquibase


I chose this instrument because:


1) the Tool keeps track of which changeset-s has already been applied to the instance DB and only those rolls that have not been rolled and which still need to concatit. If in the process of rolling forward the application of any change dropped by error, after the cause you restart the roll forward and Liquibase continues execution from that changeset and where they stopped.


2) Ability to set changeset-attributes runOnChange and runAlways greatly simplifies change management, in particular, recreatable objects.


3) the context Property allows you to execute/not to execute the changeset-s depending on the current environment (for example, to run unit tests on the prod).


It was not a full feature list.


Repository


He here. It provides "hard" (tables, indices, integrity constraints) and "soft" (triggers, procedures, views) objects changeset-s with the tags sql and sqlFile, attributes runOnChange and runAlways and without.


Which is not in the repository


Due to lack of need in the repository there is no such useful features/steps that I usually use in my projects:


the
    the
  • Preconditions — allows you to specify the execution condition changeset-a;
  • Compiling schema objects at the end of the roll. In Oracle's dbms_utility.compile_schema(user, false); the

  • Run unit tests.
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

A Bunch Of MODx Revolution + LiveStreet

Monitoring PostgreSQL with Zabbix

PostgreSQL load testing using JMeter, Yandex.Tank and Overload