Using liquibase for DDL and DML statements.
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 22 Feb 2015 20:04:29 +0000 (21:04 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 22 Feb 2015 20:05:25 +0000 (21:05 +0100)
MyBatis/MyBatis-Spring/README.txt
MyBatis/MyBatis-Spring/createdatabase.sh [deleted file]
MyBatis/MyBatis-Spring/pom.xml
MyBatis/MyBatis-Spring/src/main/resources/liquibase/ddlChangelog.xml [new file with mode: 0644]
MyBatis/MyBatis-Spring/src/main/resources/liquibase/dmlChangelog.xml [new file with mode: 0644]
MyBatis/MyBatis-Spring/src/main/resources/liquibase/liquibaseChangeLogs.xml [new file with mode: 0644]
MyBatis/MyBatis-Spring/src/main/resources/spring-config.xml

index 3511f09..2272363 100644 (file)
@@ -1,4 +1,3 @@
-Create database with createdatabase.sh script.
 
 export M2_HOME=/opt/maven/apache-maven-2.2.1
 PATH=$M2_HOME/bin:$PATH
@@ -6,3 +5,30 @@ PATH=$M2_HOME/bin:$PATH
 mvn clean install -Dmaven.test.skip=true
 mvn dependency:sources
 mvn dependency:resolve -Dclassifier=javadoc
+
+
+# I am using the mybatis-generator maven plugin. So, I need always a database (it would be better to use the Eclipse plugin)
+mysql -uroot -proot -e "CREATE DATABASE mybatis_example DEFAULT CHARACTER SET utf8"
+
+mysql -uroot -proot -e "USE mybatis_example; CREATE TABLE ad (id SERIAL, company_id BIGINT, company_categ_id BIGINT, ad_gps BLOB, ad_mobile_image varchar(255), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB, DEFAULT CHARSET=utf8, COLLATE=utf8_unicode_ci"
+
+mysql -uroot -proot -e "USE mybatis_example; CREATE TABLE ad_description (id SERIAL, laguage_id BIGINT NOT NULL, ad_id BIGINT(20) UNSIGNED NOT NULL, ad_name VARCHAR(255) NOT NULL, ad_description LONGTEXT, ad_mobile_text VARCHAR(500) NOT NULL, ad_link VARCHAR(3000) NOT NULL, PRIMARY KEY (id), INDEX(ad_id), FOREIGN KEY (ad_id) REFERENCES ad (id) ON DELETE CASCADE) ENGINE=InnoDB, DEFAULT CHARSET=utf8, COLLATE=utf8_unicode_ci"
+
+# Run mvn clean install (mybatis-generator plugin creates autogenerated code from tables)
+mvn clean install
+
+# Drop database (we want to check liquibase is working with Spring)
+mysql -uroot -proot -A -e "drop database mybatis_example"
+
+# Liquibase requires (AFAIK) of an existing schema
+mysql -uroot -proot -e "CREATE DATABASE mybatis_example DEFAULT CHARACTER SET utf8"
+
+# Run TestMain.java :)
+
+
+# Useful commands for liquibase that I used in order to create the changelog files from an existing schema.
+# Changelog from DDL. Creates DDL changelog from current database (if schema was previously created without liquibase as above)
+/opt/liquibase/liquibase --driver=com.mysql.jdbc.Driver --classpath=$HOME/.m2/repository/mysql/mysql-connector-java/5.1.9/mysql-connector-java-5.1.9.jar --logLevel=debug --changeLogFile=src/main/resources/liquibase/ddlChangelog.xml --url="jdbc:mysql://localhost/mybatis_example" --username=root --password=root generateChangeLog 
+
+# Changelog for DML. Creates DML changelog from current database (if there are data)
+/opt/liquibase/liquibase --driver=com.mysql.jdbc.Driver --classpath=$HOME/.m2/repository/mysql/mysql-connector-java/5.1.9/mysql-connector-java-5.1.9.jar --logLevel=debug --changeLogFile=src/main/resources/liquibase/dmlChangelog.xml --url="jdbc:mysql://localhost/mybatis_example" --username=root --password=root --diffTypes="data" generateChangeLog
diff --git a/MyBatis/MyBatis-Spring/createdatabase.sh b/MyBatis/MyBatis-Spring/createdatabase.sh
deleted file mode 100755 (executable)
index ef2bb57..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-mysql -uroot -proot -e "CREATE DATABASE mybatis_example DEFAULT CHARACTER SET utf8"
-
-mysql -uroot -proot -e "USE mybatis_example; CREATE TABLE ad (id SERIAL, company_id BIGINT, company_categ_id BIGINT, ad_gps BLOB, ad_mobile_image varchar(255), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB, DEFAULT CHARSET=utf8, COLLATE=utf8_unicode_ci"
-
-# Por alguna extraña razon no pude poner el id de esta tabla como serial y no tiene ahora este id autoincrement
-# Daba un error raro diciendo que no podia haber 2 claves con autoincrement en la misma tabla. Pero sí se puede...
-# debo estar haciendo algo mal... :(
-mysql -uroot -proot -e "USE mybatis_example; CREATE TABLE ad_description (id BIGINT(20) UNSIGNED NOT NULL, laguage_id BIGINT NOT NULL, ad_id SERIAL NOT NULL, ad_name VARCHAR(255) NOT NULL, ad_description LONGTEXT, ad_mobile_text VARCHAR(500) NOT NULL, ad_link VARCHAR(3000) NOT NULL, PRIMARY KEY (id), INDEX(ad_id), FOREIGN KEY (ad_id) REFERENCES ad (id) ON DELETE CASCADE) ENGINE=InnoDB, DEFAULT CHARSET=utf8, COLLATE=utf8_unicode_ci"
index a4c386b..0471644 100644 (file)
@@ -10,6 +10,7 @@
   <properties>
     <mybatis.generator.outputdirectory>${project.build.directory}/generated-sources/mybatis-generator/</mybatis.generator.outputdirectory>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <liquibase.version>3.3.0</liquibase.version>
   </properties>
   <dependencies>
     <dependency>
       <artifactId>cglib</artifactId>
       <version>2.2.2</version>
     </dependency>
+    <dependency>
+      <groupId>org.liquibase</groupId>
+      <artifactId>liquibase-core</artifactId>
+      <version>${liquibase.version}</version>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
diff --git a/MyBatis/MyBatis-Spring/src/main/resources/liquibase/ddlChangelog.xml b/MyBatis/MyBatis-Spring/src/main/resources/liquibase/ddlChangelog.xml
new file mode 100644 (file)
index 0000000..8aef71d
--- /dev/null
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.3.xsd">
+    <changeSet author="gustavo (generated)" id="1424631556445-1">
+        <createTable tableName="ad">
+            <column autoIncrement="true" name="id" type="BIGINT">
+                <constraints primaryKey="true"/>
+            </column>
+            <column name="company_id" type="BIGINT"/>
+            <column name="company_categ_id" type="BIGINT"/>
+            <column name="ad_gps" type="BLOB"/>
+            <column name="ad_mobile_image" type="VARCHAR(255)"/>
+            <column defaultValueComputed="CURRENT_TIMESTAMP" name="created_at" type="TIMESTAMP">
+                <constraints nullable="false"/>
+            </column>
+            <column defaultValue="0000-00-00 00:00:00" name="updated_at" type="TIMESTAMP">
+                <constraints nullable="false"/>
+            </column>
+        </createTable>
+        <!-- 
+                You do not need this if you created your schema with the right charset and collation (because
+             it is inherited from schema to tables and rows) anyhow this is just an example of what you can do.
+               -->
+        <modifySql dbms="mysql">
+            <append value="ENGINE=InnoDB, DEFAULT CHARSET=utf8, COLLATE=utf8_unicode_ci"/>
+        </modifySql>
+    </changeSet>
+    <changeSet author="gustavo (generated)" id="1424631556445-2">
+        <createTable tableName="ad_description">
+            <column autoIncrement="true" name="id" type="BIGINT">
+                <constraints primaryKey="true"/>
+            </column>
+            <column name="laguage_id" type="BIGINT">
+                <constraints nullable="false"/>
+            </column>
+            <column name="ad_id" type="BIGINT">
+                <constraints nullable="false"/>
+            </column>
+            <column name="ad_name" type="VARCHAR(255)">
+                <constraints nullable="false"/>
+            </column>
+            <column name="ad_description" type="LONGTEXT"/>
+            <column name="ad_mobile_text" type="VARCHAR(500)">
+                <constraints nullable="false"/>
+            </column>
+            <column name="ad_link" type="VARCHAR(3000)">
+                <constraints nullable="false"/>
+            </column>
+        </createTable>
+        <!-- 
+                You do not need this if you created your schema with the right charset and collation (because
+             it is inherited from schema to tables and rows) anyhow this is just an example of what you can do.
+               -->
+        <modifySql dbms="mysql">
+            <append value="ENGINE=InnoDB, DEFAULT CHARSET=utf8, COLLATE=utf8_unicode_ci"/>
+        </modifySql>
+    </changeSet>
+    <changeSet author="gustavo (generated)" id="1424631556445-3">
+        <addUniqueConstraint columnNames="id" constraintName="id" deferrable="false" disabled="false" initiallyDeferred="false" tableName="ad"/>
+    </changeSet>
+    <changeSet author="gustavo (generated)" id="1424631556445-4">
+        <addForeignKeyConstraint baseColumnNames="ad_id" baseTableName="ad_description" constraintName="ad_description_ibfk_1" deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="ad"/>
+    </changeSet>
+</databaseChangeLog>
diff --git a/MyBatis/MyBatis-Spring/src/main/resources/liquibase/dmlChangelog.xml b/MyBatis/MyBatis-Spring/src/main/resources/liquibase/dmlChangelog.xml
new file mode 100644 (file)
index 0000000..13a4e12
--- /dev/null
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.3.xsd http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
+    <changeSet author="gustavo (generated)" id="1424628789069-1">
+        <insert tableName="ad">
+            <column name="id" valueNumeric="1"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="bild.jpg"/>
+            <column name="created_at" valueDate="2014-12-17 23:27:36.0"/>
+            <column name="updated_at" valueDate="2014-12-17 23:27:36.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="2"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="bild.jpg"/>
+            <column name="created_at" valueDate="2014-12-17 23:29:10.0"/>
+            <column name="updated_at" valueDate="2014-12-17 23:29:10.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="3"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-27 17:13:46.0"/>
+            <column name="updated_at" valueDate="2014-12-27 17:13:47.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="4"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-27 17:14:39.0"/>
+            <column name="updated_at" valueDate="2014-12-27 17:15:27.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="5"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-27 23:38:47.0"/>
+            <column name="updated_at" valueDate="2014-12-27 23:38:47.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="6"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-27 23:39:53.0"/>
+            <column name="updated_at" valueDate="2014-12-27 23:39:53.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="7"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-27 23:39:54.0"/>
+            <column name="updated_at" valueDate="2014-12-27 23:39:54.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="8"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-27 23:40:21.0"/>
+            <column name="updated_at" valueDate="2014-12-27 23:40:21.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="9"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-27 23:40:21.0"/>
+            <column name="updated_at" valueDate="2014-12-27 23:40:21.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="10"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-27 23:42:34.0"/>
+            <column name="updated_at" valueDate="2014-12-27 23:42:34.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="11"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-27 23:42:34.0"/>
+            <column name="updated_at" valueDate="2014-12-27 23:42:34.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="12"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:07:34.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:07:34.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="13"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:07:35.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:07:35.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="14"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:10:20.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:10:20.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="15"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:10:21.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:10:21.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="16"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:10:21.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:10:21.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="17"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:10:21.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:10:21.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="18"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:10:21.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:10:21.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="19"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:10:21.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:10:21.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="20"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:10:21.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:10:21.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="21"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:19:06.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:19:06.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="23"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:20:08.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:20:08.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="25"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:31:11.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:31:11.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="26"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:31:12.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:31:12.0"/>
+        </insert>
+        <insert tableName="ad">
+            <column name="id" valueNumeric="27"/>
+            <column name="company_id" valueNumeric="2"/>
+            <column name="company_categ_id" valueNumeric="200"/>
+            <column name="ad_gps"/>
+            <column name="ad_mobile_image" value="mobileImage.jpg"/>
+            <column name="created_at" valueDate="2014-12-28 00:31:12.0"/>
+            <column name="updated_at" valueDate="2014-12-28 00:31:12.0"/>
+        </insert>
+    </changeSet>
+</databaseChangeLog>
diff --git a/MyBatis/MyBatis-Spring/src/main/resources/liquibase/liquibaseChangeLogs.xml b/MyBatis/MyBatis-Spring/src/main/resources/liquibase/liquibaseChangeLogs.xml
new file mode 100644 (file)
index 0000000..740f261
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<databaseChangeLog
+        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
+
+    <!-- DDL -->
+    <include file="liquibase/ddlChangelog.xml" />
+
+    <!-- DML -->
+    <include file="liquibase/dmlChangelog.xml" />
+    <!--
+    <changeSet author="gustavo" id="1">
+        <sqlFile path="liquibase/dmlChangelog.xml" stripComments="true"/>
+    </changeSet>
+    -->
+
+</databaseChangeLog>
index 0fa5d05..27a2ea2 100644 (file)
     <bean id="exampleService" class="de.example.mybatis.spring.service.ExampleService">
         <property name="adMapper" ref="adMapper" />
     </bean>
+
+    <bean id="liquibase" class="liquibase.integration.spring.SpringLiquibase">
+        <property name="dataSource" ref="dataSource" />
+        <property name="changeLog" value="classpath:/liquibase/liquibaseChangeLogs.xml" />
+    </bean>
     
 </beans>