liquibase.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 12:41:52 +0200
changeset 1903 901e7394849f
parent 1844 7427de2e34ea
child 1905 fba288d59662
permissions -rw-r--r--
Decrease intent to increase space usage on mobile.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1838
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
.. -*- coding: utf-8; -*-
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
.. include:: HEADER.rst
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
============
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
 LiquiBase.
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
============
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
.. contents::
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
Introducing LiquiBase to existing project.
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
==========================================
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
Official statement about introducing LiquiBase to existing project are:
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
  http://www.liquibase.org/documentation/existing_project.html
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
    Adding Liquibase on an Existing project
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
There are two approaches:
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
 * create full schema definition prior to introducing Liquibase
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
 * works only with current changes becase Liquibase basically work only with changesets and only
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
   special supplied instruments care about full schema definition
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
1840
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    23
To create full schema definition in LiquiBase XML changelog format you may run::
1838
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
1840
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    25
  $ mvn liquibase:generateChangeLog -Dliquibase.outputChangeLogFile=...
1838
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
on clean project without Liquibase. Or set name for changelog output file in ``pom.xml``.
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
(here reduced not fully worked declaration)::
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
  <plugin>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
      <groupId>org.liquibase</groupId>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
      <artifactId>liquibase-maven-plugin</artifactId>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
      <version>${liquibase.version}</version>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
      <configuration>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
          <outputChangeLogFile>changelog.xml</outputChangeLogFile>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
      </configuration>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
  </plugin>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
.. NOTE::
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
   ``pom.xml`` settings have precedence over ``-Dliquibase.outputChangeLogFile=...`` unless you
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
   define it as::
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
     <properties>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
         <liquibase.outputChangeLogFile>${project.build.directory}/changelog.xml</liquibase.outputChangeLogFile>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
     </properties>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
     <plugins>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
         <plugin>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
             <configuration>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
                 <outputChangeLogFile>${liquibase.outputChangeLogFile}</outputChangeLogFile>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
             </configuration>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
         </plugin>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
     </plugins>
031c61d1a8bd Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
1840
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    55
To create full schema definition in LiquiBase SQL format you may first to dump
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    56
your schema definition::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    57
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    58
  $ mysqldump --no-data -u $USER -p $DB_NAME > schema.sql
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    59
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    60
then check ``schema.sql`` for danger operations. For example I forget to add
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    61
``--skip-add-drop-table`` option to ``mysqldump`` and so remove any ``DROP
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    62
TABLE`` lines by editor.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    63
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    64
Becase we already have tables I replace ``CREATE TABLE`` statements with::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    65
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    66
  CREATE TABLE IF NOT EXISTS
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    67
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    68
Now my file is safely can be applied to production database without loosing
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    69
data and can recreate new schema in empty database.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    70
1842
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
    71
 * http://www.operatornew.com/2012/11/automatic-db-migration-for-java-web.html
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
    72
 * http://www.baeldung.com/liquibase-refactor-schema-of-java-app
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
    73
 * http://www.liquibase.org/documentation/existing_project.html
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
    74
 * http://www.liquibase.org/tutorial-using-oracle
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
    75
1844
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
    76
SQL syntax.
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
    77
===========
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
    78
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
    79
 * http://www.liquibase.org/2015/09/liquibase-without-changelogs.html
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
    80
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
    81
1840
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    82
Generate difference between databases.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    83
======================================
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    84
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    85
`This site
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    86
<http://www.broadleafcommerce.com/docs/core/current/appendix/managing-db-versions-migrations-with-liquibase>`_
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    87
suggest using Hibernate ``hibernate.hbm2ddl.auto=create`` to create clean schema
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    88
with Hibernate and compare it with previous one. So you:
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    89
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    90
 * create empty schema and grand permissions for user
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    91
 * register project to new user and schema, for example with Spring config::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    92
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    93
    <bean id="dataSource"
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    94
       class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    95
       <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    96
       <property name="url" value="jdbc:mysql://localhost:3306/app"/>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    97
       <property name="username" value="dbuser"/>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    98
       <property name="password" value="123456"/>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
    99
    </bean>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   100
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   101
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   102
       <property name="dataSource" ref="dataSource" />
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   103
       <property name="jpaVendorAdapter">
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   104
           <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   105
               <property name="generateDdl" value="false"/>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   106
               <property name="showSql" value="false"/>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   107
           </bean>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   108
       </property>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   109
       <property name="packagesToScan" value="com.app.domain" />
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   110
       <property name="jpaProperties">
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   111
          <props>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   112
              <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   113
              <prop key="hibernate.hbm2ddl.auto">create</prop>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   114
              <prop key="hibernate.default_schema">schema_v2_0</prop>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   115
          </props>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   116
       </property>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   117
    </bean>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   118
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   119
 * run Hibernate initialisation code via test or application deploy so
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   120
   ``hibernate.hbm2ddl.auto=create`` trigger to new schema generation.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   121
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   122
 * configure Maven ``pom.xml`` with paths and authentication data to old and new
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   123
   schema::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   124
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   125
     <plugin>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   126
         <groupId>org.liquibase</groupId>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   127
         <artifactId>liquibase-maven-plugin</artifactId>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   128
         <version>${liquibase.version}</version>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   129
         <configuration>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   130
             <changeLogFile>${basedir}/src/main/resources/sql/master.xml</changeLogFile>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   131
             <diffChangeLogFile>changelogDiff.xml</diffChangeLogFile>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   132
             <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   133
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   134
             <driver>com.mysql.jdbc.Driver</driver>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   135
             <username>dbuser</username>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   136
             <password>123456</password>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   137
             <url>jdbc:mysql://localhost:3306/app</url>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   138
             <defaultSchemaName>schema_v1.1</defaultSchemaName>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   139
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   140
             <referenceDriver>com.mysql.jdbc.Driver</referenceDriver>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   141
             <referenceUsername>dbuser</referenceUsername>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   142
             <referencePassword>123456</referencePassword>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   143
             <referenceUrl>jdbc:mysql://127.0.0.1:3306/app</referenceUrl>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   144
             <referenceDefaultSchemaName>schema_v2.0</referenceDefaultSchemaName>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   145
         </configuration>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   146
         <dependencies>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   147
             <dependency>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   148
                 <groupId>mysql</groupId>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   149
                 <artifactId>mysql-connector-java</artifactId>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   150
                 <version>5.1.6</version>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   151
             </dependency>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   152
         </dependencies>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   153
     </plugin>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   154
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   155
   .. NOTE::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   156
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   157
      ``username`` and ``referenceUsername`` as ``url`` and ``referenceUrl``,
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   158
      and ``defaultSchemaName`` and ``referenceDefaultSchemaName``, etc pairs
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   159
      should be adopted to your connection/authentication data. This settings
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   160
      also possible externalize to::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   161
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   162
        <changeLogFile>${basedir}/src/main/resources/sql/master.xml</changeLogFile>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   163
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   164
 * Review diff in ``changelogDiff.xml`` after::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   165
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   166
     $ mvn liquibase:diff
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   167
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   168
Resulted ``changelogDiff.xml`` may be registered to project with ``schema_v1.1``
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   169
schema state.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   170
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   171
It is possible to move inner part of ``changelogDiff.xml`` to the last changeset
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   172
that managed by LiquiBase in your project.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   173
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   174
Alternatively that file may be registered via ``<include file="..."/>`` syntax.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   175
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   176
After that staying in project at ``schema_v1.1`` state you may upgrade from
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   177
``schema_v1.1`` to ``schema_v2.0`` schema by::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   178
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   179
  $ mvn liquibase:update
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   180
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   181
Or create, review and apply SQL upgrade script (for your DBA)::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   182
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   183
  $ mvn liquibase:updateSQL
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   184
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   185
TODO:
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   186
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   187
  $ mvn liquibase:update -Dliquibase.changesToApply=1
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   188
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   189
Generating difference between database and JPA.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   190
===============================================
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   191
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   192
LiquiBase come with plug-in which mimics like SQL driver. So we may run::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   193
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   194
  $ mvn liquibase:diff
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   195
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   196
to get difference in LiquiBase XML format between our current database and JPA
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   197
schema description.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   198
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   199
With::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   200
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   201
  $ mvn liquibase:updateSQL
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   202
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   203
we get SQL update code to state that described by Hibernate.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   204
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   205
Depending on Hibernate metadata form we shoud adapt ``referenceUrl`` property.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   206
For example for Spring enabled project with JPA annotations::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   207
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   208
  <referenceUrl>hibernate:spring:com.app.domain?dialect=org.hibernate.dialect.MySQLDialect</referenceUrl>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   209
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   210
Here ``com.app.domain`` represent package with JPA annotated entities.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   211
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   212
So complete reference visit:
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   213
https://github.com/liquibase/liquibase-hibernate/wiki
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   214
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   215
Also we need Spring Beans and LiquiBase driver in classpath to resolve
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   216
dependencies during diff calculation. Complete Maven piece look like::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   217
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   218
  <plugin>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   219
      <groupId>org.liquibase</groupId>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   220
      <artifactId>liquibase-maven-plugin</artifactId>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   221
      <version>${liquibase.version}</version>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   222
      <configuration>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   223
          <changeLogFile>${basedir}/src/main/resources/sql/master.xml</changeLogFile>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   224
          <propertyFile>${liquibase.profile}</propertyFile>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   225
          <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   226
          <logging>info</logging>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   227
          <driver>com.mysql.jdbc.Driver</driver>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   228
          <defaultSchemaName>app</defaultSchemaName>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   229
          <changelogSchemaName>app</changelogSchemaName>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   230
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   231
          <!-- For mvn liquibase:updateSQL -->
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   232
          <migrationSqlOutputFile>migration.sql</migrationSqlOutputFile>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   233
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   234
          <referenceUrl>hibernate:spring:com.app.domain?dialect=org.hibernate.dialect.MySQLDialect</referenceUrl>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   235
          <diffChangeLogFile>changelogDiff.xml</diffChangeLogFile>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   236
          <diffTypes>tables,views,columns,indexes,foreignkeys,primarykeys,uniqueconstraints</diffTypes>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   237
      </configuration>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   238
      <dependencies>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   239
          <dependency>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   240
              <groupId>org.springframework.data</groupId>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   241
              <artifactId>spring-data-jpa</artifactId>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   242
              <version>${spring-data.version}</version>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   243
          </dependency>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   244
          <dependency>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   245
              <groupId>org.liquibase.ext</groupId>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   246
              <artifactId>liquibase-hibernate4.2</artifactId>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   247
              <version>3.5</version>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   248
          </dependency>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   249
      </dependencies>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   250
  </plugin>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   251
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   252
http://stackoverflow.com/questions/27877154/liquibase-and-jpa-annotated-entities
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   253
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   254
http://www.baeldung.com/liquibase-refactor-schema-of-java-app
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   255
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   256
How changelogs are identified.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   257
==============================
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   258
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   259
Upstream deside use three field to identify changeset:
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   260
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   261
 * each changeset mandatory marked by pair of ``user:id`` (which is actually any
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   262
   non-whitespace characters)
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   263
 * full path to file with changeset
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   264
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   265
``user:id`` is actually any non-whitespace and non-colon text with
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   266
non-whitespace text. Upstream suggest to use changeset authro identity for
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   267
``user`` and numbers or reason/name for changeset for ``id``.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   268
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   269
``user:id`` pair should be unique for file.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   270
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   271
Reason to capture full path as part of identifier is very dumb. Upstream
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   272
arguments:
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   273
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   274
 * http://forum.liquibase.org/topic/why-does-the-change-log-contain-the-file-name
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   275
 * http://forum.liquibase.org/topic/i-need-to-ignore-the-filename-in-the-processing-to-see-if-a-change-set-has-already-been-applied
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   276
 * http://forum.liquibase.org/topic/logical-filepath-in-change-sets-and-changelog
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   277
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   278
is very Java centric and require sticking to fixed changeset file location in
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   279
``CLASSPATH``.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   280
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   281
When you work with same file on different hosts / tools you should very
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   282
carefully check that path satisfy conventions that used with previous LiquiBase
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   283
work for concrete DB.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   284
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   285
I have incompatibilities between String integration and Maven plug-in. Because I
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   286
use full path in Maven and CLASSPATH relative in String.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   287
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   288
Hopefully there is logicalFilePath attribute.
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   289
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   290
In XML syntax in may be applied to top level tag::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   291
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   292
  <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   293
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   294
                     xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   295
                     logicalFilePath="legacy.xml">
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   296
      ...
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   297
  </databaseChangeLog>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   298
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   299
or may be overridden by each changeset::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   300
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   301
  <changeSet author="admin" id="fix-25" logicalFilePath="fix.xml">
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   302
     ...
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   303
  </changeSet>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   304
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   305
SQL syntax also have ``logicalFilePath`` attribute for top level file mark
1842
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   306
(implemented in v3.3)::
1840
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   307
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   308
    --liquibase formatted sql  logicalFilePath:legacy.sql
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   309
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   310
and may be overridden by each changeset::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   311
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   312
    --changeset legacy:1  logicalFilePath:other.sql
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   313
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   314
To verify that settings have effect run::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   315
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   316
  mvn liquibase:changelogSyncSQL
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   317
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   318
and review migration.sql. Corresponding ``pom.xml`` part::
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   319
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   320
  <plugin>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   321
      <groupId>org.liquibase</groupId>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   322
      <artifactId>liquibase-maven-plugin</artifactId>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   323
      <version>${liquibase.version}</version>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   324
      <configuration>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   325
          <changeLogFile>${basedir}/src/main/resources/sql/master.xml</changeLogFile>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   326
          <propertyFile>${liquibase.profile}</propertyFile>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   327
          <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   328
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   329
          <migrationSqlOutputFile>migration.sql</migrationSqlOutputFile>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   330
      </configuration>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   331
  </plugin>
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   332
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   333
..
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   334
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   335
 * http://stackoverflow.com/questions/19896436/how-to-configure-liquibase-not-to-include-file-path-or-name-for-calculating-chec
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   336
 * http://stackoverflow.com/questions/19959755/liquibase-how-to-disable-filename-column-check
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   337
 * http://stackoverflow.com/questions/18767815/refactoring-liquibase-changelog-files
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   338
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   339
Consult
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   340
``liquibase-core/src/main/java/liquibase/parser/core/formattedsql/FormattedSqlChangeLogParser.java``
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   341
for further info .
da2130eaa115 How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1838
diff changeset
   342
1842
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   343
Split changesets into files.
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   344
============================
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   345
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   346
It is not possible to split file formatted in SQL LiquiBase syntax.
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   347
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   348
It is not possible to set tag with SQL LiquiBase syntax. To workaround this
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   349
issue you may split SQL file and set tags in XML sytax::
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   350
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   351
    <changeSet author="master" id="1">
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   352
        <tagDatabase tag="v0.1"/>
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   353
    </changeSet>
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   354
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   355
    <include file="legacy.sql" relativeToChangelogFile="true"/>
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   356
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   357
    <changeSet author="master" id="2">
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   358
        <tagDatabase tag="v1.0"/>
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   359
    </changeSet>
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   360
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   361
    <include file="v1.0.sql" relativeToChangelogFile="true"/>
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   362
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   363
Also you should be interested in storing stored procedures in separate file and
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   364
apply ``runOnChange`` attribure for XML syntax::
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   365
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   366
    <changeSet author="admin" id="proc-hello">
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   367
        <createProcedure
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   368
                runOnChange="true"
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   369
                encoding="utf8"
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   370
                dbms="oracle">
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   371
            CREATE OR REPLACE PROCEDURE hello AS
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   372
            BEGIN
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   373
              DBMS_OUTPUT.PUT_LINE('Hello');
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   374
            END;
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   375
        </createProcedure>
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   376
    </changeSet>
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   377
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   378
or  with SQL syntax::
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   379
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   380
    --changeset admin:proc-hello  runOnChange:true
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   381
    CREATE OR REPLACE PROCEDURE hello AS
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   382
    BEGIN
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   383
      DBMS_OUTPUT.PUT_LINE('Hello');
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   384
    END;
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   385
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   386
Some people suggest to use one file per stored procedure / package.
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   387
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   388
How big chould be changeset?
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   389
============================
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   390
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   391
Less is better.
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   392
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   393
Some databases doesn't support transactional DDL (e.g. Oracle, SQL Server), each
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   394
DDL statement should be put into a single changeset.
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   395
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   396
Putting unrelated operations into single changeset leads to trouble when last or
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   397
intermediate of them fail to apply.
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   398
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   399
Try to group constraint adding in corresponding update statements. If you have
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   400
wrong update that doesn't prepare data to constraint it shouldn't be commited
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   401
but rewritten.
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   402
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   403
 * http://blog.mgm-tp.com/2010/11/data-modeling-part2/
e66fcbaf99fa Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1840
diff changeset
   404
1844
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   405
Labels vs Contexts.
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   406
===================
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   407
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   408
 * http://forum.liquibase.org/topic/labels-vs-contexts-in-3-3-0
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   409
 * http://www.liquibase.org/2014/11/contexts-vs-labels.html
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   410
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   411
How to apply LiquiBase to you DB?
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   412
=================================
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   413
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   414
 * http://www.liquibase.org/2015/07/executing-liquibase.html
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   415
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   416
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   417
====================================================================
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   418
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   419
 * http://south.readthedocs.org/en/latest/index.html
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   420
 * https://code.djangoproject.com/wiki/SchemaEvolution
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   421
 * http://guides.rubyonrails.org/active_record_basics.html
7427de2e34ea Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1842
diff changeset
   422