spring-jpa, liquibase, examples about how to update change sets in database
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Wed, 14 Sep 2016 12:57:13 +0000 (14:57 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Wed, 14 Sep 2016 12:57:13 +0000 (14:57 +0200)
SpringJava/JPA/README
SpringJava/JPA/spring-jpa-persistence/src/main/resources/spring-configuration/liquibase/ddlChangelog.xml

index 5b41f97..a1a9bd4 100644 (file)
@@ -90,3 +90,11 @@ Postman-Token: 62441d69-daab-b4d2-e73a-efca92d93aeb
 
 # Changelog for DML. Creates DML changelog from current database (if there are data)
 /opt/liquibase/liquibase3.5.1/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/spring-configuration/liquibase/dmlChangelog.xml --url="jdbc:mysql://localhost/mybatis_example" --username=root --password=root --diffTypes="data" generateChangeLog
+
+# Update changelog DDL with new changeSets.
+/opt/liquibase/liquibase3.5.1/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/spring-configuration/liquibase/ddlChangelog.xml --url="jdbc:mysql://localhost/mybatis_example" --username=root --password=root update
+
+# Update changelog DDL with selected changeSets (based on label expressions)
+/opt/liquibase/liquibase3.5.1/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/spring-configuration/liquibase/ddlChangelog.xml --labels='!VERSIONC' --url="jdbc:mysql://localhost/mybatis_example" --username=root --password=root update
+
+
index e2f5eb9..b2a96ad 100644 (file)
@@ -1,5 +1,28 @@
 <?xml version="1.1" 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.5.xsd">
+
+    <!--
+        Liquibase update database with new change sets. Examples.
+
+    <changeSet author="gustavo test" id="1" labels="VERSIONA">
+        <sql>
+            CREATE TABLE VERSIONA (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
+        </sql>
+    </changeSet>
+
+    <changeSet author="gustavo test" id="2" labels="VERSIONB">
+        <sql>
+            CREATE TABLE VERSIONB (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
+        </sql>
+    </changeSet>
+
+    <changeSet author="gustavo test" id="3" labels="VERSIONC">
+        <sql>
+            CREATE TABLE VERSIONC (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
+        </sql>
+    </changeSet>
+    -->
+
     <changeSet author="gustavo (generated)" id="1469119656864-1" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
         <createTable tableName="AD">
             <column autoIncrement="true" name="ID" type="BIGINT">