liquibase.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 21 Dec 2015 12:40:38 +0200
changeset 1838 031c61d1a8bd
child 1840 da2130eaa115
permissions -rw-r--r--
Introducing LiquiBase to existing project.

.. -*- coding: utf-8; -*-
.. include:: HEADER.rst

============
 LiquiBase.
============
.. contents::

Introducing LiquiBase to existing project.
==========================================

Official statement about introducing LiquiBase to existing project are:

  http://www.liquibase.org/documentation/existing_project.html
    Adding Liquibase on an Existing project

There are two approaches:

 * create full schema definition prior to introducing Liquibase
 * works only with current changes becase Liquibase basically work only with changesets and only
   special supplied instruments care about full schema definition

To create full schema debinition you may run::

  mvn liquibase:generateChangeLog -Dliquibase.outputChangeLogFile=...

on clean project without Liquibase. Or set name for changelog output file in ``pom.xml``.
(here reduced not fully worked declaration)::

  <plugin>
      <groupId>org.liquibase</groupId>
      <artifactId>liquibase-maven-plugin</artifactId>
      <version>${liquibase.version}</version>
      <configuration>
          <outputChangeLogFile>changelog.xml</outputChangeLogFile>
      </configuration>
  </plugin>

.. NOTE::

   ``pom.xml`` settings have precedence over ``-Dliquibase.outputChangeLogFile=...`` unless you
   define it as::

     <properties>
         <liquibase.outputChangeLogFile>${project.build.directory}/changelog.xml</liquibase.outputChangeLogFile>
     </properties>
     <plugins>
         <plugin>
             <configuration>
                 <outputChangeLogFile>${liquibase.outputChangeLogFile}</outputChangeLogFile>
             </configuration>
         </plugin>
     </plugins>